Jump to content

Unable to interact with 'Save As' Dialog with ControlSetText and ControlClick


Recommended Posts

My SciTE-Lite Version 4.4.6 (32-bit) code

Local $fileName = $CmdLine[1]
WinWait("Save As")
If Not WinActive("Save As") Then WinActivate("Save As")
ControlFocus("Save As", "", "Edit1")
ControlSetText("Save As", "", "Edit1", $fileName)
ConsoleWrite("Saving file to " & $fileName & @CRLF)
Sleep(2000)
ControlClick("Save As", "", "Button2") 

I am running this from SciTE-Lite against Chrome v103.0.5060.134 (Official Build) (64-bit)

The "Save As" dialog is up, and I see the existing text within the "Edit1" is highlighted, but that's all that is happening.

I have tried

$sText = ControlGetText("Save As", "", "Edit1")

 which returns what's there, so AutoIt does see the control.

I have also tried "Send()", "ControlSend", and not getting anywhere.

As well as, "ControlClick()" doesn't work either.

If I do

Local $rc = ControlClick("Save As", "", "Button2")
ConsoleWrite("Return Value is " & $rc & @CRLF)

Outputs: "Return Value is 1", and "1" is supposed to be "Success".

Not sure why I am this trouble.

Can someone help me get this to work correctly? Just trying to enter the file name into the field, and press the "Save" button.

Link to comment
Share on other sites

for testing:

Opt('WinWaitDelay', 250)
Opt('WinDetectHiddenText', 1)
Opt('MouseCoordMode', 0)
Opt("WinTitleMatchMode", 2) ;1=start, 2=subStr, 3=exact, 4=advanced, -1 to -4=Nocase
Opt("SendKeyDelay", 75)
Opt("SendKeyDownDelay", Default)
Opt("SendCapslockMode", 1)

Opt("MustDeclareVars", 1)
Opt("TrayIconDebug", 1)

Global $fileName = "MyFileName"

Global $hWnd = WinWait("Guardar como", "", 15) ;<<<< Windows Spanish
WinActivate($hWnd)
WinWaitActive($hWnd, "", 5)
Sleep(100)
If WinActive($hWnd, "") Then
    ;https://www.sevenforums.com/performance-maintenance/153744-does-win7-have-shortcut-navigation-pane.html
    ;https://superuser.com/questions/41979/keyboard-shortcut-to-hide-show-explorer-navigation
    ;ControlClick("Adjuntar archivo(s)", "", "[CLASS:SysTreeView32; INSTANCE:1]")
    Sleep(200)
    Send("!o") ;<<<< Windows Spanish
    Sleep(200)
    Send($fileName)
    Sleep(500)
    ControlClick($hWnd, "", "[ID:1]")
EndIf
Sleep(500)

 

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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