1
Best Dialog Extender / Re: set focus in "file name" control?
« on: September 11, 2012, 10:40 PM »
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.
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 [Select]
- 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