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)
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
WinWaitActive($hWnd, "", 5)
If WinActive($hWnd, "") Then
    ;ControlClick("Adjuntar archivo(s)", "", "[CLASS:SysTreeView32; INSTANCE:1]")
    Send("!o") ;<<<< Windows Spanish
    ControlClick($hWnd, "", "[ID:1]")


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

  • Recently Browsing   0 members

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