Is there any way to get the full path to App Shortcut Folder (%AppShortcutFolderName%)?
Announcement
Collapse
No announcement yet.
Path to App Shortcut Folder
Collapse
X
-
The %AppShortcutFolderName% session variable will only hold the name of the folder, which is typically the product name:
The folder name is "My Product", and the shortcut itself is captioned "Demo Application". The location of this folder can be located in the user's profile, or the application may have been installed for all users of the computer - so there are two possibilities here.
If you didn't offer the installation for all users - or configured the setup in such a manner that it would install the product always for all users - then you have only one location to check for the shortcut. Otherwise, you need to check two locations. Here is some sample code:
Code:[COLOR="#0000FF"]local[/COLOR] sShortcut [COLOR="#FF0000"]=[/COLOR] Shell[COLOR="#FF0000"].[/COLOR]GetFolder(SHF_STARTMENUPROGRAMS) [COLOR="#FF0000"]..[/COLOR] SessionVar[COLOR="#FF0000"].[/COLOR]Expand([COLOR="#800080"]"[COLOR="#800080"]\\[/COLOR]%AppShortcutFolderName%[COLOR="#800080"]\\[/COLOR]Demo Application.lnk"[/COLOR])[COLOR="#FF0000"];[/COLOR] [COLOR="#0000FF"]if[/COLOR] File[COLOR="#FF0000"].[/COLOR]DoesExist(sShortcut) [COLOR="#0000FF"]then[/COLOR] Dialog[COLOR="#FF0000"].[/COLOR]Message([COLOR="#800080"]"info"[/COLOR][COLOR="#FF0000"],[/COLOR] [COLOR="#800080"]"Found the shortcut at "[/COLOR] [COLOR="#FF0000"]..[/COLOR] sShortcut [COLOR="#FF0000"]..[/COLOR] [COLOR="#800080"]"!"[/COLOR])[COLOR="#FF0000"];[/COLOR] [COLOR="#0000FF"]else[/COLOR] Dialog[COLOR="#FF0000"].[/COLOR]Message([COLOR="#800080"]"info"[/COLOR][COLOR="#FF0000"],[/COLOR] sShortcut [COLOR="#FF0000"]..[/COLOR] [COLOR="#800080"]" not found"[/COLOR])[COLOR="#FF0000"];[/COLOR] sShortcut [COLOR="#FF0000"]=[/COLOR] Shell[COLOR="#FF0000"].[/COLOR]GetFolder(SHF_STARTMENUPROGRAMS_COMMON) [COLOR="#FF0000"]..[/COLOR] SessionVar[COLOR="#FF0000"].[/COLOR]Expand([COLOR="#800080"]"[COLOR="#800080"]\\[/COLOR]%AppShortcutFolderName%[COLOR="#800080"]\\[/COLOR]Demo Application.lnk"[/COLOR])[COLOR="#FF0000"];[/COLOR] [COLOR="#0000FF"]if[/COLOR] File[COLOR="#FF0000"].[/COLOR]DoesExist(sShortcut) [COLOR="#0000FF"]then[/COLOR] Dialog[COLOR="#FF0000"].[/COLOR]Message([COLOR="#800080"]"info"[/COLOR][COLOR="#FF0000"],[/COLOR] [COLOR="#800080"]"Found the shortcut at "[/COLOR] [COLOR="#FF0000"]..[/COLOR] sShortcut [COLOR="#FF0000"]..[/COLOR] [COLOR="#800080"]"!"[/COLOR])[COLOR="#FF0000"];[/COLOR] [COLOR="#0000FF"]else[/COLOR] Dialog[COLOR="#FF0000"].[/COLOR]Message([COLOR="#800080"]"info"[/COLOR][COLOR="#FF0000"],[/COLOR] sShortcut [COLOR="#FF0000"]..[/COLOR] [COLOR="#800080"]" not found"[/COLOR])[COLOR="#FF0000"];[/COLOR] [COLOR="#0000FF"]end[/COLOR] [COLOR="#0000FF"]end[/COLOR]
Ulrich
Comment