Sign in to follow this  
Followers 0
icu

Is InetGet() broken with IE9?

11 posts in this topic

Dear AutoIt community,

I've been wasting a lot of time with IE9 and pulling my hair out until I found some obscure post in the forum saying that I need to put IE9 into IE8 compatibility mode for the website I want to automate just to get it to work with AutoIt.

Okay so I did that and things seemed to be working fine until I want to download files from a site that has login access.

I've tried using InetGet and it creates files that look like the downloads I want except they are 1KB files that clearly haven't been downloaded properly.

The following line of code is straight out of my program:

InetGet ($as_Flashcard_Link[0], $s_Working_Folder & "\" & "NISS_" & $s_File_Date & "_Flashcard.pdf", 1, 0)

Please bear in mind I have all the right includes, and I have verified that the links are correct.

For clarity I'll show what the variable strings are:

$as_Flashcard_Link[0] = "http://www.newsinslowspanish.com/db/pdfretrieve.php?episode_num=8"
$s_Working_Folder = @MyDocumentsDir & "\" & "News In Slow Spanish"
$s_File_Date = "2009-04-24"

Maybe I have the syntax wrong or I just don't know what I don't know... but I thought I'd ask if my problems have something to do with AutoIt not working well with IE9 before I spend hours and hours trying to work out the solution.

As for alternative ways to download files I thought about doing the following:

$o_IE_Flashcard = _IECreate ($as_Flashcard_Link[0])
_IELoadWait ($o_IE_Flashcard)

That way creates problems handling the resultant 'View Downloads - Windows Internet Explorer' pop-up box. I'm not the only person struggling with this and apparently someone has come up with a solution in Ruby but without any knowledge of Ruby it's useless to me.

Any and all guidance is greatly appreciated.

-icu

Share this post


Link to post
Share on other sites



This is what I get when I use your link directly in a browser:

insert into flashcard_download_log values (1318921200, , 8 ) --- You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' 8 )' at line 1

I'm guessing it might not be InetGet, rather it might be your link is bad.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Hi BrewManNH,

Thanks for your reply... the link won't work for you because you don't have the login credentials for the website.

The link works 100% fine if IE is logged into the website and it is entered as the URL, but then I get the problems handling the 'View Downloads - Windows Internet Explorer' pop-up box. I was just worried that there are problems with InetGet() because it doesn't seem to download the whole file.

Kind regards,

icu

Edited by icu

Share this post


Link to post
Share on other sites

Hi JohnOne,

Thanks for your post. I'm not too certain but I did a forum search before and found a post that indicated that InetGet would have the same credentials as IE. I don't remember or have the link to the post sorry.

Good point you make though about checking the underlying assumptions. Maybe someone can suggest a way of handling the IE9 pop-up download box?

Kind regards,

icu

Share this post


Link to post
Share on other sites

If you are having problems with IE9 you might do worse than trying out the latest beta version of Autoit.

I've not tried it myself, but have read that it has a few issues solved either with the Standard UDFs or the gizzards of Autoit itself (or both).


AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

Have you tried this approach?

To use a username and password when connecting simply prefix the servername with "username:password@", e.g.

http://myuser:mypassword@www.somesite.com


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

@BrewManNH: On your advice I have given InetGet() another go and it didn't work :-(

I checked everything... my code was the following and once again it looked like it downloaded the file when I ran my script but it turns out it's yet another 215b file in the folder and obviously didn't open.

InetGet ("http://my_real_login:my_real_password@www.newsinslowspanish.com/db/pdfretrieve.php?episode_num=9", "C:\Users\My_Real_Username\Documents\News In Slow Spanish\2009-05-16\NISS_2009-05-16_Flashcard.pdf", 16, 0)

I then spent hours trying to open the link in a new _IECreate() and try to automate the resulting Save As box and I've had some success using pixel co-ordinates for MouseClick() and ControlClick() but I've been stopped in my tracks and have had no end of trouble when I try and set the folder path for the download.

Unless anyone has any other ideas I'll have to try giving the beta a go as JohnOne has suggested.

Edited by icu

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

I had problems with this until I did it in an embedded IE window.

Something like

$Filepath = "C:\Users\My_Real_Username\Documents\News In Slow Spanish\2009-05-16\NISS_2009-05-16_Flashcard.pdf"
$oIE = _IECreateEmbedded()
GUICreate("File Download", 660, 500, (@DesktopWidth - 640) / 2, (@DesktopHeight - 580) / 2, $DS_MODALFRAME + $WS_CAPTION + $WS_SYSMENU + $WS_CLIPSIBLINGS + $WS_CLIPCHILDREN)
$GUIActiveX = GUICtrlCreateObj($oIE, 10, 10, 640, 480)
GUISetState(@SW_HIDE)
$FileDownload = InetGet("http://my_real_login:my_real_password@www.newsinslowspanish.com/db/pdfretrieve.php?episode_num=9", $FilePath, 17, 0)
ToolTip("")
InetClose($FileDownload)
Edited by Alodar

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

@Alodar: Thank you for your post, great idea.

I tried your code (modified with the right includes, correct login credentials and correct file path) from my work PC running Windows XP (my home PC is Windows 7) with IE7 (I've got IE9 at home) and it still won't work.

This makes me think that InetGet() won't work for the website which seems strange since the link will start a download if set as the URL for _IECreate() and I know the login credentials are correct. Any idea why this would be the case?

Edited by icu

Share this post


Link to post
Share on other sites

Seems to me like it's related to a trigger on the php page. If you change the code I listed earlier to GUISetState(@SW_SHOW), does it load the correct page? If so, does using _IENavigate to the correct address cause it to try to download the file?

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