News and Reviews > Best Dialog Extender
set focus in "file name" control?
rshory:
I tried every compatibility mode back to Windows 95. No difference.
rjbull:
Is it possible to write a macro in AHK, AutoIt, PowerPro or something, that will watch for the appropriate window, and put the cursor in the right location whenever it first appears?
rshory:
Well, like everything in computers "it's easy -- after you know how".
Of the three scripting suggestions, I chose AutoIt at random. It took me about a day to learn enough to write the few lines of code I needed. Here it is, with all my debugging comments still in. I just start it in the background, and then kill the process after I'm done scanning; or leave it running till next time.
--- Code: Text ---While 1 $handle = WinWaitActive("Save As", "File &name:") ; listen for Save As dialog; MsgBox(0, "Event", "Save As window active") If (WinExists("HP Precisionscan Pro") = 1) Then ; is the parent app running? ; assure the app is indeed the parent of this Save As dialog $HPPsPHandle = WinGetHandle("HP Precisionscan Pro"); msgbox(0,"PS handle", $HPPsPHandle) $result = DllCall("user32.dll", "int", "GetParent", "hwnd", $handle); msgbox(0,"Result0",$result[0]); msgbox(0,"Result1",$result[1]) ; parent handle is in hex, and result in decimal, but equality works If ($result[0] = $HPPsPHandle) Then; msgbox (0,"OK", "They match") Send("!n") ; send Alt-n to set focus to File Name control EndIf EndIf ; wiat till the dialog closes, so as not to re-fire WinWaitClose($handle)WEnd
Navigation
[0] Message Index
[*] Previous page
Go to full version