Hello,
Is there a method for having the default 'StartingFolder' be in view in the FileSelectFolder dialog?
For example, if I have FileSelectFolder's StartingFolder to be a deeply nested starting point in a long list of folders then AHK selects it properly but the selected StartingFolder is pretty far off screen. It *is* being properly selected but the user doesn't know that without scrolling and scrolling until they find the selected folder.
Is there a method for having the selection be visible? I.E. scroll down so the StartingFolder is visible in the dialog?
AHK v2.
Thank you
[Mod action: Topic moved to the v2 section since OP indicated it was for v2.]
FileSelectFolder StartingFolder not in view
-
- Posts: 11
- Joined: 18 Feb 2022, 11:32
Re: FileSelectFolder StartingFolder not in view
A moderator has moved this topic to the v2 section because you have indicated this is for AutoHotkey v2. However, FileSelectFolder exists only in v1; it is named DirSelect in v2. Which is it?
-
- Posts: 11
- Joined: 18 Feb 2022, 11:32
Re: FileSelectFolder StartingFolder not in view
Sorry I was mistaken. It's v1.1
[Mod action: Moved topic back to v1]
[Mod action: Moved topic back to v1]
-
- Posts: 11
- Joined: 18 Feb 2022, 11:32
Re: FileSelectFolder StartingFolder not in view
Just curious to know if anyone might know how address the OP? Thank you
Re: FileSelectFolder StartingFolder not in view
Since no one has posted a more elegant solution, here's something that works:
You need the reference image of the highlighted folder. Here's the one I made: It may look different on your system.
Code: Select all
SetTimer, ScrollToFolder, -500
FileSelectFolder, Dir, *C:\MyPath\ToFolder\DeepInto\FileTree
return
ScrollToFolder:
WinWaitActive, ahk_class #32770
WinGetPos,,, WinWidth, WinHeight, ahk_class #32770
loop, 1000 { ; limit to 1000 to avoid infiinite loop
ImageSearch,,, 0, 0, WinWidth, WinHeight, HighlightedFolder.png
if ErrorLevel
SendInput, ^{PgDn}
} until !ErrorLevel
return
You need the reference image of the highlighted folder. Here's the one I made: It may look different on your system.
-
- Posts: 11
- Joined: 18 Feb 2022, 11:32
Re: FileSelectFolder StartingFolder not in view
Thank you very much for the answer! I was not able to get this to work for me (my folder is a Box Drive folder with a different icon, and making my own didn't seem to work) but I was able to work around the issue using the SelectFolderEx script from viewtopic.php?t=18939. Thank you for your assistance!boiler wrote: ↑11 Aug 2022, 18:19Since no one has posted a more elegant solution, here's something that works:Code: Select all
SetTimer, ScrollToFolder, -500 FileSelectFolder, Dir, *C:\MyPath\ToFolder\DeepInto\FileTree return ScrollToFolder: WinWaitActive, ahk_class #32770 WinGetPos,,, WinWidth, WinHeight, ahk_class #32770 loop, 1000 { ; limit to 1000 to avoid infiinite loop ImageSearch,,, 0, 0, WinWidth, WinHeight, HighlightedFolder.png if ErrorLevel SendInput, ^{PgDn} } until !ErrorLevel return
You need the reference image of the highlighted folder. Here's the one I made:
HighlightedFolder.png
It may look different on your system.