FileSelectFile & Shortcuts & Windows 10

Discuss Autohotkey related topics here. Not a place to share code.
Forum rules
Discuss Autohotkey related topics here. Not a place to share code.
User avatar
Posts: 223
Joined: 11 Aug 2016, 02:32
GitHub: lmstearn

FileSelectFile & Shortcuts & Windows 10

03 Mar 2019, 07:32

[Moderator's note: Topic moved from Bug Reports.]

Hi there,
Not a bug report, but more of an observation on the way the Shell handles the file dialogs in the latest editions of Windows:
Create a shortcut to Notepad: as per attached:
(760 Bytes) Downloaded 21 times

Code: Select all

FileSelectFile, OutputVar, 3,, Open a file`, Shortcuts resolved, (*.exe; *.bat; *.com; *.cmd; *.pif; *.msc; *.lnk; *.scr)
Open the dialog and select the lnk file, and there is no more navigation into the folder via the folder shortcut.

Worth noting, that in removing *.lnk from the filter, the link still shows in the dialog for :

Code: Select all

FileSelectFile, OutputVar, nOptions,, Open a file`, Shortcuts resolved, (*.exe; *.bat; *.com; *.cmd; *.pif; *.msc; *.scr)
... regardless of what is in nOptions or whether the *.exe filter is present or not.
It used to work, but unable to recollect from what epoch. :P
No big deal, as what V2 is offering will be an improvement.
Thanks for reading!
Edit: The CLSIDS (e.g. Start Menu Folder, My Computer) don't seem to work either in FileSelectFile as they do in the Run command.
Built-ins like A_StartMenu and A_ProgramsCommon still work with FileSelectFile.
The online documentation is marking a change in parameters for the next release:
FileSelectFolder, OutputVar , StartingFolder, Options, Prompt
:arrow: itros "ylbbub eht tuO kaerB" a ni kcuts m'I pleH
Posts: 6613
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos

Re: FileSelectFile & Shortcuts & Windows 10

21 Sep 2019, 00:37

I don't get the point of this topic, or why it was in the Bug Reports forum. The behaviour is intuitive, standard to all Windows file dialogs, and has probably never changed in the history of Windows (at least since this type of file dialog was introduced).

File dialogs behave as follows:
  • If the filter includes *.lnk, selecting a shortcut file returns the path of the shortcut file itself.
  • If the shortcut's target is a folder, selecting the shortcut is the same as selecting the shortcut's target.
  • If the shortcut's target is a file which matches the current filter, selecting the shortcut is the same as selecting the shortcut's target.
  • Otherwise, the shortcut is not shown, nor would its target be shown.
So in other words, a shortcut file is treated the same as its target, except in the case where the filter includes *.lnk, since the user presumably wants to select the shortcut file itself. If the filter is only *.lnk, the target of a shortcut is never a valid selection since it can't be a lnk file. If the dialog didn't allow selection of lnk files when only lnk files are shown, it would be mostly useless.

Changing the filter to *.* causes all shortcut files to be shown, and selecting a shortcut will return the path of the target, not the shortcut itself. Shortcuts to folders are also shown, but cause navigation into the folder.

One can change the current filter to something not in the list by typing it into the filename box and pressing Enter. Changing the filter affects which shortcut files are shown and what effect they have.

This was all confirmed with Notepad's Open dialog on Windows XP.

Oddly enough, .url files (such as shortcuts to Steam games) are shown on Windows 10 but cause a warning dialog that just says "Catastrophic failure". :lol:

Return to “General Discussion”

Who is online

Users browsing this forum: No registered users and 0 guests