Jump to content

Problem with ControlSend for file download


Elaine
 Share

Recommended Posts

Hi,

I have seen the advice that to send commands and text from AutoIt to an application, we should use ControlSend() instead of Send() and not use WinActive or WinWaitActive when no a session started during Remote Desktop connection is minimized, disconnected or logged off. This has resolved my problem of logging into an MS Access database to provide the username and password, but the same syntax is not working when sent to a 'File Download' window to save the file.

Code that works:

Run("C:\Program Files\Microsoft Office\OFFICE11\MSACCESS.EXE C:\myWork\myStudy.mdb /nostartup /x getExtract")

WinWait("Password Required")

ControlSend("Password Required","", "[CLASS:RichEdit20W; INSTANCE:1]", "thePassword")

ControlSend("Password Required","", "[CLASS:Button; INSTANCE:1]", "{ENTER}")

But the File Download page hangs, waiting for input with this code:

WinWait("File Download");

ControlSend("File Download", "", "[CLASS:Button; TEXT:Save]", "{ENTER}")

and also with these:

ControlSend("File Download", "", "[CLASS:Button; INSTANCE:2]", "{ENTER}")

ControlSend("File Download", "", "[CLASS:Button; INSTANCE:2]", "!s")

ControlSend("File Download", "", "[CLASS:Button; TEXT:&Save]", "{ENTER}")

In fact the ControlSend doesn't work at all even with Remote Desktop connected.

What am I missing?

I really appreciate any help!

Thanks,

Elaine

Link to comment
Share on other sites

it almost looks like you are trying to send text to buttons. if you don't need to send text and just need to "press" buttons, maybe controlclick would work better?

010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Link to comment
Share on other sites

ControlClick works fine when the session is active, but when the script runs as a scheduled task without me being logged in (over Remote Desktop) or having diminished my RDC session, ControlClick doe not work. My searched showed that I need to use ControlSend. That command works for clicking a button in MS Access but not on File Download.

Thanks for trying!

Elaine

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...