Jump to content

How to download file using autoit without focus on browser? - (Moved)


Recommended Posts

Hi,

I am downloading the file from IE browser through selenium. I am able to download a file if my focus is on browser. But unable to download if focus is not on browser. Could any one please help me?

 

My script :

Send("!s")
; Wait for 9 seconds
Sleep(9000)
; Press Keyboard ENTER button.
Send("{ENTER}")

 

Called using below instruction:

Runtime.getRuntime().exec("C:\\FilePath\\DownloadFile.exe")

Link to post
Share on other sites

if you manually press keys on the keyboard does it send those commands to your currently opened window? or does it send the commands to some other window in the background?

If @error Then
    MsgBox(262192, "", @ComputerName & " slaps " & @UserName & " around a bit with a large trout!")
    EndIf

"Yeah yeah patience, how long will that take?"  -Ed Gruberman

REAL search results

Link to post
Share on other sites
54 minutes ago, Hrushi said:

@alienclone if i manually press keys on the keyboard , it will sent the command for currently open window, not on browser.

yes, i was being a smartass, your script is "Send"ing key presses, key presses will always go to the active window, that script will never work on a window that doesnt have focus.

 

if you cant use the InetGet functions i pointed to in my other post, you can use Winactivate to make your browser window active first, then send keys.

If @error Then
    MsgBox(262192, "", @ComputerName & " slaps " & @UserName & " around a bit with a large trout!")
    EndIf

"Yeah yeah patience, how long will that take?"  -Ed Gruberman

REAL search results

Link to post
Share on other sites
  • 2 weeks later...
  • 2 months later...

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