Sign in to follow this  
Followers 0
Dave668

Download file through internet explorer

22 posts in this topic

in my defence i have searched the forum for over 1 hour and didn't find what i was looking for so i post here instead :-)

problem: i need to download a file through internet explorer locally on my machine automatically.

why? the webpage is active directory enabled so using IE bypasses the AD checking.

problem manifest: i can run an hidden ie by using: ;_IECreate ("$webpage", 0, 0)

then i get this annoying "File Download" box, telling me to "cancel" "save" or "open"

script:

_IECreate ("$webpage", 0, 0)

WinWaitActive("File Download" , "Do you want to open or save this file?")

Send("!s")

but the file download box just sits there...

i think this should be an easy script right? i am a newbie in this so please help :-)

Share this post


Link to post
Share on other sites



Here I go jumping off into something I don't know 1st hand about... but you could try this:

_IECreate ("$webpage", 0, 0)
WinWait("File Download" , "Do you want to open or save this file?")
ControlClick('File Download', '', 'Button1');Assuming button 1 is OK or whatever you need to click.

Can you not use _InetGet() though?


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Simply use the following:

InetGet("yourlinkhere.com/validextension.txt", "C:\Destination\")

Kurt


Awaiting Diablo III..

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

none of these seems to work.

trying the InetGet i get "Error parsing function call.: "

the url is not an direct link to the document. it's a link to our document management system, so the URL is interpreted by an metaface server who in turn returns the file. So my best bet is to go trough internet explorer..

Edited by Dave668

Share this post


Link to post
Share on other sites

none of these seems to work.

trying the InetGet i get "Error parsing function call.: "

the url is not an direct link to the document. it's a link to our document management system, so the URL is interpreted by an metaface server who in turn returns the file. So my best bet is to go trough internet explorer..

Why don't you show how you are using InetGet()... Error parsing function call is you calling it wrong.

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

I can't understand why InetGet() wouldn't work.. Are you sure you are using the correct parameters? Check the helpfile, maybe.

Kurt

PS: Smoke_N, you've finally changed your avatar! Lovin' it.


Awaiting Diablo III..

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Why don't you show how you are using InetGet()... Error parsing function call is you calling it wrong.

$WebPage = "long link to document system"; <- this link is correct!

InetGet("$WebPage", "C:\temp\")

Edited by Dave668

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Don't use " 's with your variable! so use this:

$WebPage = "long link to document system"; <- this link is correct!
InetGet($WebPage, "C:\temp\")

And it should all work.

Kurt

EDIT: Small mistake in script.

Edited by _Kurt

Awaiting Diablo III..

Share this post


Link to post
Share on other sites

Don't use " 's with your variable! so use this:

$WebPage = "long link to document system"; <- this link is correct!
InetGet($WebPage, "C:\temp\"

And it should all work.

Kurt

still noting in c:\temp...

Share this post


Link to post
Share on other sites

So your url looks like

$WebPage = "http://www.someurl.com/somefile.exe";Notice I have the file I want to get there
InetGet($WebPage, 'C:\temp\')
?

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

So your url looks like

$WebPage = "http://www.someurl.com/somefile.exe";Notice I have the file I want to get there
InetGet($WebPage, 'C:\temp\')
?

No. look in my previous reply, its not a direct link. Its a "faked" url to a server. The server digs up the right doc and version based upon the URL i send it. in this case the URL is a direct linmk to the latest version of this document.

Edited by Dave668

Share this post


Link to post
Share on other sites

No. look in my previous reply, its not a direct link. Its a "faked" url to a server. The server digs up the right doc and version.

Sorry ... I missed that, then yes, I would assume that would be your best bet... and I'll leave it to those here that actually use IE to help you further... GL.

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

$WebPage = "http://www.someurl.com/somefile.exe";Notice I have the file I want to get there
InetGet($WebPage, 'C:\temp\somefile.exe')

I thinks the failure is the missing "somefile.exe" for the locale filename.

Share this post


Link to post
Share on other sites

That's probably the problem! Wow, I need some sleep big time, should have easily spotted that one :whistle:

Kurt


Awaiting Diablo III..

Share this post


Link to post
Share on other sites

seems i cant even detect this window.

i tried with

If WinExists("File Download") Then

MsgBox(0, "", "Window exists")

EndIf

i get no box :-(

also tried to add: Opt("WinDetectHiddenText", 1)

didn't help..

Share this post


Link to post
Share on other sites

I still don't know why this doesn't work:

$WebPage = "http://www.someurl.com/somefile.exe" ;Notice I have the file I want to get there
InetGet($WebPage, 'C:\temp\somefile.exe') ;Notice that I have the full name & extension of destination

?

Kurt


Awaiting Diablo III..

Share this post


Link to post
Share on other sites

Look at Opt('WinTitleMatch', 4) and try to use WinExists('classname=Class<<whatever the class is under "title" in window info tool')


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

I still don't know why this doesn't work:

$WebPage = "http://www.someurl.com/somefile.exe" ;Notice I have the file I want to get there
InetGet($WebPage, 'C:\temp\somefile.exe') ;Notice that I have the full name & extension of destination

?

Kurt

$WebPage = "http://www.someurl.com/somefile.exe" ;Notice I have the file I want to get there <- This is not the URL to the file!! its an masked URL, the server gets the file.

otherwise this would have worked yes!!

Share this post


Link to post
Share on other sites

#19 ·  Posted (edited)

Ok i replicated this with a file on the internet:

$WebPage = "http://se2.php.net/get/php-5.2.1-Win32.zip/from/se.php.net/mirror"; notice this is not a direct link to a file, but it will start a download.

$oIE = _IECreate ($WebPage,0,0)

WinActivate("File Download","")

Send("!s")

all i get is this download box:

post-21422-1173692537_thumb.jpg

then the script just waits..i want to download this file directly to c:\temp or whatever.

i found some more info on this but for vb, not figured out how to do this though, also the post is old so might not be relevant.

http://www.vbip.com/forum/topic.asp?id=6882

The same behaviour can be shown with this URL "http://phpnuke.org/modules.php?name=Downloads&d_op=getit&lid=425" also not a direct link, but it gets you the file.

[EDIT: spelling errors! added a new d/l link to try]

Edited by Dave668

Share this post


Link to post
Share on other sites

Now i feel stupid, both of the links i provided actually worked the way you have suggested. But it does not work with my internal URL still. I get this in the file when trying:

"You must have Internet Explorer v5.0 or later installed to use this program!"

so the "InetGet($WebPage...." can't be used. I will see if i can find an appropriate URL.

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  
Followers 0