09-12-2021, 09:27 AM
In this case can be used win, because window name is different: dir1, dir2, Temp.
Also it's possible to get folder path.
Function FolderWindowGetAddress
Function FolderWindowFind
Also it's possible to get folder path.
Function FolderWindowGetAddress
;/
function! w str&address
;Gets the address field text from a folder window.
;It's the editable text displayed when clicked. It can be folder path, or special folder name like "Documents", or whatever.
;EXAMPLE
;int w=win("Test" "CabinetWClass")
;if(FolderWindowGetAddress(w _s)) out _s
if(!WinTest(w "CabinetWClass")) ret
int c=child("Address: *" "ToolbarWindow32" w 0x401); if(!c) ret
_s.getwintext(c); if(_s.len<10) ret
address.get(_s 9)
ret 1
Function FolderWindowFind
;/
function# $address [flags] ;;flags: 1 wildcard, 2 regex
;Finds folder window with specified text in the address field.
;address - the address text. It can be folder path, or special folder name like "Documents", or whatever. See <help>FolderWindowGetPath</help>. Case-insensitive. Can be wildcard or regex, depending on flags.
;EXAMPLE
;int w=FolderWindowFind("c:\test")
;outw w
ARRAY(int) a; int i
win "" "CabinetWClass" "explorer.exe" 0x401 "" a
for i 0 a.len
,int w=a[i]
,if FolderWindowGetAddress(w _s)
,,int ok
,,sel flags&3
,,,case 1 ok = matchw(_s address 1)
,,,case 2 ok = findrx(_s address 0 1)>=0
,,,case else ok = _s~address
,,if(ok) ret w