|
1 | 1 | #Requires AutoHotkey v1.1.33+ |
2 | 2 | ;@Ahk2Exe-SetMainIcon ReplaceBrowseForFolder.ico |
| 3 | +;@Ahk2Exe-SetVersion 1.2 |
3 | 4 | ;@Ahk2Exe-Base Unicode 32* |
4 | 5 | ;@Ahk2Exe-PostExec "MPRESS.exe" "%A_WorkFileName%" -q -x, 0,, 1 |
5 | 6 | ;@Ahk2Exe-IgnoreBegin |
@@ -93,35 +94,37 @@ SetPathForBrowseForFolder(TargetPath, DialogHwnd:=0x0) { |
93 | 94 | } |
94 | 95 | ControlGet, hctl, Hwnd,, SysTreeView321, % "ahk_id" DialogHwnd |
95 | 96 | RTV := new RemoteTreeview(hctl) |
96 | | - PathTree_Length := PathTree.Length() |
97 | 97 | For Index, Level in PathTree |
98 | 98 | { |
99 | | - hItem := RTV.GetHandleByText(Level) |
100 | | - If !hItem { |
101 | | - FurthestPath := "" |
102 | | - For Index, Level in PathTree |
103 | | - FurthestPath .= Level "\" |
104 | | - Throw Exception("Walk failed at: `n" FurthestPath, "RemoteTreeview.GetHandleByText") |
105 | | - Return |
106 | | - } |
107 | | - If (Index = PathTree_Length) { |
108 | | - RTV.SetSelection(hItem, 1) |
109 | | - } Else { |
110 | | - RTV.SetSelection(hItem, 0) |
111 | | - RTV.Expand(hItem) |
112 | | - Loop |
113 | | - hChild := RTV.GetChild(hItem) |
114 | | - Until hChild |
| 99 | + T_Start := A_TickCount |
| 100 | + Loop { |
| 101 | + hItem := RTV.GetHandleByText(Level) |
| 102 | + If hItem { |
| 103 | + Break |
| 104 | + } Else If (A_TickCount - T_Start >= 60000) { |
| 105 | + Msgbox, 0x1004, , % "Been waiting for a minute. Abort?" |
| 106 | + IfMsgBox, Yes |
| 107 | + Return |
| 108 | + Else |
| 109 | + T_Start := A_TickCount |
| 110 | + } Else If !WinExist("ahk_id" DialogHwnd) { |
| 111 | + Return |
| 112 | + } |
115 | 113 | } |
| 114 | + RTV.SetSelection(hItem, 0) |
| 115 | + RTV.Expand(hItem) |
116 | 116 | } |
| 117 | + Loop |
| 118 | + Controlsend, , {Enter}, % "ahk_id " DialogHwnd |
| 119 | + Until !WinExist("ahk_id" DialogHwnd) |
117 | 120 | } |
118 | 121 |
|
119 | 122 | GetExplorerPathTree(FolderPath) { |
120 | 123 | Shell := ComObjCreate("Shell.Application") |
121 | 124 | Folder := Shell.NameSpace(FolderPath) |
122 | 125 | PathTree := [] |
123 | 126 | Loop |
124 | | - PathTree.InsertAt(1, Folder.Title) |
| 127 | + PathTree.InsertAt(1, Folder.Self.Name) |
125 | 128 | Until !(Folder := Folder.ParentFolder) |
126 | 129 | Return PathTree |
127 | 130 | } |
|
0 commit comments