csjojo
Posts: 10
Joined: Tue Sep 01, 2009 6:32 am

Shortcut argument [Folder] path, need "\\" instead of "\"

TIA. I'm still getting used to the AI app. Extremely handy and deep. My issue is that I need to pass in a folder path in my shortcuts. I've created that folder in the files and folders and have its Identifier( [UserFolder]). And in my shortcuts Ive created, I've edited the properties under arguments so that it is passed in. "--arg "[UserFolder]". Which works fine. Now the issue I have is the app Im calling is specifically(on windows) looking for that path BUT it requires the path seperator be "\\" rather than the "\". Is there any way to edit these such that when the shortcut is created, in the shortCut's properties "Target" box it has appname.exe --arg "C:\\MyPath\\" rather than the normally created " appname.exe --arg "C:\MyPath\". Is this possible? Any help would be great. Thanks again.
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Shortcut argument [Folder] path, need "\\" instead of "\"

Hi,

For what you need you can try this approach:
- in the Custom Actions page create a Property set with Formatted custom action under "InstallExecuteSequence" -> "CostFinalize" (you can show "CostFinalize" by using the "Show Standard Action" toolbar button)
- set the "Property Name" to USER_FOLDER_SHORTCUT
- for the "Formatted Text" field use the "Edit" button to select the folder
- under this custom action create another one which modifies the USER_FOLDER_SHORTCUT property, replacing "\" with "\\"
- use the USER_FOLDER_SHORTCUT property for the shortcut

For modifying the property value you can use this VBScript code:

Code: Select all

Dim path
Dim modifiedPath
Dim tokens

path = Session.Property("USER_FOLDER_SHORTCUT ")
path = path & "$"

tokens = Split(path,"\", -1)

i = 0
modifiedPath = ""
Do While tokens(i) <> "$"
  modifiedPath = modifiedPath & tokens(i) & "\\"
  i = i + 1
Loop

Session.Property("USER_FOLDER_SHORTCUT") = modifiedPath
This code can be pasted into a .VBS file which can be added as an attached custom action. After the "Property set with formatted" sets USER_FOLDER_SHORTCUT to the folder path, the script replaces "\" with "\\".

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
csjojo
Posts: 10
Joined: Tue Sep 01, 2009 6:32 am

Re: Shortcut argument [Folder] path, need "\\" instead of "\"

Well I must say a few things. Firstly the solution your provided works perfectly. Thank you very much. Secondly I have say how impressed I am with your knowledge of the product,the products flexibility and power, and most importantly is the speed and accuracy of your forum help. As a beginning software developer, I am surprised at the remarkable speed of help through the forums. More companies should strive for this level of support. Kudos to you Cosmin and the rest of the team. Very impressed. Thanks again.

Return to “Common Problems”