FileSelectFolder StartingFolder not in view

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
damascus_the_white
Posts: 11
Joined: 18 Feb 2022, 11:32

FileSelectFolder StartingFolder not in view

Post by damascus_the_white » 28 Jul 2022, 16:56

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.]

lexikos
Posts: 9553
Joined: 30 Sep 2013, 04:07
Contact:

Re: FileSelectFolder StartingFolder not in view

Post by lexikos » 28 Jul 2022, 23:50

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?

damascus_the_white
Posts: 11
Joined: 18 Feb 2022, 11:32

Re: FileSelectFolder StartingFolder not in view

Post by damascus_the_white » 04 Aug 2022, 13:16

Sorry I was mistaken. It's v1.1


[Mod action: Moved topic back to v1]

damascus_the_white
Posts: 11
Joined: 18 Feb 2022, 11:32

Re: FileSelectFolder StartingFolder not in view

Post by damascus_the_white » 11 Aug 2022, 14:13

Just curious to know if anyone might know how address the OP? Thank you

User avatar
boiler
Posts: 16767
Joined: 21 Dec 2014, 02:44

Re: FileSelectFolder StartingFolder not in view

Post by boiler » 11 Aug 2022, 18:19

Since 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
HighlightedFolder.png (463 Bytes) Viewed 450 times
It may look different on your system.

damascus_the_white
Posts: 11
Joined: 18 Feb 2022, 11:32

Re: FileSelectFolder StartingFolder not in view

Post by damascus_the_white » 16 Aug 2022, 13:53

boiler wrote:
11 Aug 2022, 18:19
Since 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.
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!

Post Reply

Return to “Ask for Help (v1)”