Announcement

Collapse
No announcement yet.

Path to App Shortcut Folder

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Path to App Shortcut Folder

    Is there any way to get the full path to App Shortcut Folder (%AppShortcutFolderName%)?

  • #2
    The %AppShortcutFolderName% session variable will only hold the name of the folder, which is typically the product name:

    Click image for larger version

Name:	SCRN-2016-05-17-03.png
Views:	1
Size:	42.7 KB
ID:	284403

    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.

    Click image for larger version

Name:	SCRN-2016-05-17-04.png
Views:	1
Size:	2.9 KB
ID:	284404

    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]
    Executing this code on the sample shown above would produce this output:

    Click image for larger version

Name:	SCRN-2016-05-17-05.png
Views:	1
Size:	9.3 KB
ID:	284405

    Ulrich

    Comment


    • #3
      Thanks, Ulrich... that works great!

      Comment

      Working...
      X