Jump to content
Sign in to follow this  
tommytx

How to Click Save on "File Download" menu.

Recommended Posts

tommytx

I must be making this hard as I never had a problem with it using VBS.

Here is the simplified program:

#include <IE.au3>

Sleep(3000)

$out = "http://adsentry.net/members/short_page.htm"

$oIE = _IECreate($out)

_IELoadWait ($oIE)

Sleep(3000)

$out = "http://adsentry.net/members/large1.zip"

_IENavigate ($oIE, $out)

_IELoadWait ($oIE)

Sleep(3000)

WinWait("File Download")

MsgBox(0, "My Msg", "Found File Download.")

Sleep(3000)

Send("{ALTDOWN}s{ALTUP}")

Sleep(3000)

Send("{ALTDOWN}s{ALTUP}")

These are live urls if anyone wants to do an actual test..

Here is the problem, normally this is no problem with VBS.

1. Visit just any old site above first.

2. Now connect to a zip file to download.

3. The "File Download" box comes up perfect.

4. Now it should do ALT S to start the save.

5. Now you need ALT S to do a final save after prompt for the location to save.

Absolutely nothing happens once the "File Download" box comes up.. (XP with IE7 system)

Just hangs there with no further action... its like the Window has taken control and the only way to get it to move is to do a manual Alt X which works fine.

The funny thing is I can go to the browser and visit the file to download it brings up the "File Download" box exactly the same, and now the autoit commands for Send("{ALTDOWN}s{ALTUP}") take over and push the buttons just fine.

Damnest thing I have ever seen.. any ideas or anything I can check... it you copy the file to your puter the actual urls will work so you can see the problem exactly..

Thanks in advance for anyone who will take a look and offer suggestions.

I suppose I could go to vbs, but I am want to learn all features of autoit since it has many more commands..

Share this post


Link to post
Share on other sites
Authenticity

You need to sleep a little bit until the button is ready to receive input. You can either sleep a second or loop until it's state is enabled like ControlCommand(). Works great.

Share this post


Link to post
Share on other sites
tommytx

Look again, I think I am sleep walking already.. just before the command to save I sleep for 3 full seconds...

Do you see a place in the code above that I am missing an important sleep? Thanks for the help.

I just found out another tidbit, this works great to click the save button but only when getting the item manually.

ControlClick("File Download", "", 4427)

I used the autoit window tool to get the ID number and when I manually pull up the "File Download" box it clicks the save button just fine, but if I use the program to pull up the "File Download" window it just sits there..

Could it be something to do with my XP operating system..

In other words when I manually visit the url below.. the ControlClick will click it ok.. but if i use the code below to bring it up no go.. and I can see that the "File Download" form has focus.. besides if it did not the program would just pass it by and end... the program is never ending just sitting there.

out = "http://adsentry.net/members/large1.zip"

_IENavigate ($oIE, $out)

_IELoadWait ($oIE)

Share this post


Link to post
Share on other sites
Authenticity

#include <IE.au3>

Dim $sOut = "http://adsentry.net/members/short_page.htm"
Dim $oIE = _IECreate($sOut)

$sOut = "http://adsentry.net/members/large1.zip"
_IENavigate($oIE, $sOut)

WinWaitActive("File Download")
Sleep(700)
ControlClick('File Download', '', 'Button2') ; ClassnamdNN is always Button2 for this specific dialog.

; What about:
; InetGet($sOut, @ScriptDir & '\large.zip')

You don't need _IEloadWait when calling functions that call it by default internally. Also, you've slept before WinWait, maybe this is the case.

Share this post


Link to post
Share on other sites
wolle7

Hi tommytx,

I'm working on a similar problem just have a look at link.

You need to sleep a little bit until the button is ready to receive input. You can either sleep a second or loop until it's state is enabled like ControlCommand(). Works great.

@Authenticity

Is the ControlCommand() the solution to kick off my sleep commands like I mentioned in my last post found on the link above?

Cheers Wolle


Cheers Wolle

Share this post


Link to post
Share on other sites
Authenticity

Well, you can pass this trouble easily.

$hwnd = WinGetHandle("File Download")

While WinExists($hwnd)
    ControlClick('File Download', '', 'Button2') ; ClassnamdNN is always Button2 for this specific dialog.
    Sleep(40)
WEnd

Share this post


Link to post
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
Sign in to follow this  

×