Jump to content

Recommended Posts

Posted (edited)

Bit of a tail chaser here.  I am new to AIT, so I'm hoping I'm missing something

win10, in Notepad then opening the Save As dialog

 

No problem updating the File Name since that's focused & selected on entry,  but I also need to ensure the (Save In)    at the top is updated.  I'm not able to find the proper magic potion that'll focus that control:

Quote
local $hNotePad = WINWAITActive("report-designer-preview",120)
; "info_"+YYYYMMDD+".CSV"
WinActivate($hNotePad)
Send ("!f")  ; alt-F (file menu) in Notepad
Send ("A")  ; hotkey to start Save As dialog
$CSVSaveFolder="C:\Temp"

; My latest efforts are the following two

a) Local $retCC = ControlClick ($hNotePad, "", "[CLASS:ToolbarWindow32; INSTANCE:2]" )  ; why does the instance number seem to also be a moving target? It was 1 now its 4 
b) Local $retCC = ControlClick ($hNotePad, "", 41477 )  ; or 1001??

 

I'd been messing with mouse coords earlier because I'd deluded myself in believing they were accurate -- until the default posn of the dialog moved.

Now, frustration increasing,  I thought, well a max'd dialog fixes coordinates, so, max the dialog. I can _manually_ do that (2-click the title bar), but I can't find anything in the AI3 help that allows an active window/dialog to be max'd, or a way to 2-click the title bar (of a window whose absolute coords one can not be sure of). Note: the Save As diag has no max-glyph in the upper right corner and the upper right corner isn't a control, but maybe could be manipulated after a move and send(enter).

I have a flat spot in my forehead from decades of "D'oh!"s , yet I still love doing it. Not getting there, but the final accomplishment.   
Any ideas?  Whether its max'ing or some clicking, thanks.

AI3control.jpg

SaveIncap.jpg

Edited by grinch
hipaa
Posted

Here's how I would do it in Windows 11. It should be fairly similar in Windows 10.

 

Local $notepadWindowTitle = "report-designer-preview"
Local $saveAsWindowName = "Save As"
Local $saveFolder = "C:\Windows\Temp"

Local $hNotePad = WinWaitActive("[CLASS:Notepad;TITLE:" & $notepadWindowTitle & ";]", "", 10)
ControlSend($hNotepad, "", $hNotepad, "^+s") ; Send "Save As" command
Local $saveAsWindow = WinWaitActive("[CLASS:#32770;TITLE:" & $saveAsWindowName & ";]", "", 2) ; Find "Save As" window
ControlSend($saveAsWindow, "", $saveAsWindow, "{F4}") ; Give keyboard focus to address bar
ControlSetText($saveAsWindow, "", "[CLASS:Edit;INSTANCE:2;]", $saveFolder) ; Write new address $saveFolder
ControlSend($saveAsWindow, "", "[CLASS:Edit;INSTANCE:2;]", "{ENTER}") ; Validate changes and exit address bar

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...