Jump to content

Click Save As on IE9


Recommended Posts

I am trying to write a script to automatically download a file from a website using IE9. I can not find a way to click the Save As button.

When I click the download button a yellow box appears at the bottom. I want to click the arrow next to the Save button and select Save As.

Here the site. http://software.intel.com/en-us/articles/vcsource-samples-cpu-animation/

Thanks

post-74212-0-79337600-1342045887_thumb.p

Link to comment
Share on other sites

  • Moderators

Hi, NAFlowers. Rather than trying to automate clicking on the SaveAs, you might try using INetGet to retrieve the document. The following works for me on that site:

#include <IE.au3>
InetGet("http://software.intel.com/file/43357", "CPUAnimation.pdf", 0, 0)

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

@JLogan3o13 is there no solution to simulate clicking the 'save as' in IE with AutoIT? Honestly I quit using AutoIT as there was no solution... I've come back hoping that there was a fix...

Link to comment
Share on other sites

I'm pretty sure that using InetGet would be a LOT easier than trying to click on a link then click on a button to do the same thing.

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

Link to comment
Share on other sites

  • Moderators

I have not seen one myself, though someone who actually does more in IE may wander by and prove me wrong. I would say that if you're willing to leave a language because you can't click on a Save As button, and don't want to take the time to figure out a workaround, you probably won't find what you're looking for anyway :)

Edited by JLogan3o13

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

I was able to find some code that can click the Save As button. But it only works if a user clicks the download button.

When I use "_IELinkClickByText($oIE, "DOWNLOAD PROJECT") " to click the download button so the save as click does not work. Is there another way I can automatically click the download button?

$hIE = WinGetHandle("[Class:IEFrame]")
$hCtrl = ControlGetHandle($hIE,"","[Class:DirectUIHWND]")
$aPos = ControlGetPos($hIE,"",$hCtrl)
$x = $aPos[2]-160
$y = $aPos[3]-30


ControlClick($hIE, "", $hCtrl, "left", 1, $x, $y)
Sleep(2000)
ControlSend($hIE, "", $hCtrl,"{Down}")
Sleep(2000)
ControlSend($hIE, "", $hCtrl,"a")
Link to comment
Share on other sites

  • 3 weeks later...

@JLogan3o13: I'm assuming you're not a troll since you're a mvp. You're assumption is false, I in fact worked very hard at trying to find a solution. Weeks in fact playing around and trying different methods to click on links and save them thanks to all the javascript within the website which by the way defeats InetGet. In the end I manually spent 4 hours clicking and saving everything I needed from the website I tried to automate the downloading for. Why else but to learn the soultion would I have spent much longer trying to code something that could be manually done? And yes, I searched the forums for an answer and posted about it with no help that led to a solution. It was at that point I quit using AutoIt and started learning C# since with that language it seemed possible to advance my goals. I felt that with all the IE automation I wanted to do, I could no longer count on doing it with AutoIt. So, don't ever jump to conclusions about other people's work ethic when you don't know anything about that person. If you're such a great mvp then contribute to fixing the problem rather then making snide remarks.

Edited by icu
Link to comment
Share on other sites

  • 2 weeks later...

Is there no help for this issue? I also have been using AutoIT for a few years, and have developed lots of GUI's based on it I share with my Co-workers. I love this product so much, I even donated to the cause! But this is a big issue for me, not being able to automate downloading a file. I've tried every solution I could find within the AutoIT forum, and nothing works.

@ icu: I also am able to download what appears to be a solid file using InetGet(), however, when you open that file, it states "something is missing". then it opens in excel, and even excel asks you to log in. "no valid session. Please log in". I've not really seen that issue before, but I’ve not tried to automate downloading from a secure site in IE9 before. (HTTPS).

@ NAflowers: Thanks for trying, but you are correct, and I can't use it if someone still has to manually click a link.

@ JLogan3o13 Maybe InetGet isn't working properly for me, as I can't link it to my instance of $oIE that I used to _IECreate() and work within an iframe such as "ifmPage". Most of the calls to the links I have to do from within this iFrame page as it relates to $oIE. So just launching an InetGet() command doesn’t attach to my instance of IE. And yes, I've tried username:password@www.address" and InetGet still does not work.

Another thread stated to use a better download manager than IE9's downloading, and it is more user friendly. I did download that, but it is a lot to ask of all my co-workers, to download and install this 3rd party download manager that is more "AutoIT Friendly". Yes, it is, and yes, I can get my scripts to work now on my development box. But again, I'm looking for some solution built within AutoIT itself. (self contained).

And yes, I've downloaded the latest "Beta" and tried that, to no avail. Honestly, to me, it does not look like the Beta Version of IE.au3 has not been touched in some time:

Title: Internet Explorer Automation UDF Library for AutoIt3

Filename: IE.au3

Description: A collection of functions for creating, attaching to, reading from and manipulating Internet Explorer

Author: DaleHohm

Version: V2.4-1

Last Update: 4/26/08

Requirements: AutoIt3 3.2 or higher, Developed/Tested on WindowsXP Pro with Internet Explorer6 and Internet Explorer7

Again, I can't say how grateful I am someone has taken the time to develop this great utility! I'd be lost without it. But can't we please get support for IE9 Built into it? At least in the beta version?

Note the version and the update and the tested/developed on IE6/7. Maybe this is a low priority, but I've seen enough threads about folks having various issues with IE9 that it should be at least put on the list to include in the next Beta version.

Thanks in advance for any assistance!

Edited by kalel69
Link to comment
Share on other sites

  • 4 months later...

How did this topic get so far off into the weeds?

First, IE.au3 was originally tested on IE6 and 7, but has kept current with very few changes required to support the newer versions.

Next, there is no such thing as a "Save As" button. There are HTML tags and objects... some of them are links, some are buttons, some are many other things.

There is nothing called "Save As" on the link you provided. There is an anchor link with a CSS Class of "button" and link text of "DOWNLOAD PROJECT".

You could click on this with _IELinkClickByText, but your script would hang waiting for the dialog to be processed.

Suggest you look at the second example for _IEAction or the suggestions for input type=file in my sig for ideas on how to do this.

Dale

Edited by DaleHohm

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

the original post is referring to the IE9 navigation toolbar, the following code was borrowed from another post and I tweaked it to activate the 'save as' option

Func ClickOpenInIEBar()

#cs

Credit to Ellavader and Alshamma at

#ce

$retWin = WinGetHandle("[Class:IEFrame]", "")

$winTitle = "[HANDLE:" & $retWin & "]"

; get a handle to the control (IE9 download info bar)

$ctrlHandle = ControlGetHandle($winTitle, "", "[Class:DirectUIHWND]")

$ctrlTitle = "[HANDLE:" & $ctrlHandle & "]"

; must have this line in here in order to get a handle to the control

WinWaitActive($ctrlTitle, "[CLASS:DirectUIHWND]", 10);

$xy = ControlGetPos($winTitle, "", "[Class:DirectUIHWND]"); //will differ depending on size of control

$xpos = 585 ; $xy[2] - 100 ; depends on control size

$ypos = 55 ; also depends on control size

; Save-As Prompt

WinActivate($winTitle, "Do you want to open or save");

ControlFocus($winTitle, "Do you want to open or save", "[CLASS:DirectUIHWND]");

ControlClick($winTitle, "", "[Class:DirectUIHWND]", "primary", 1, $xpos, $ypos); //activates the drop-down menu next to 'save'

; must send 'down-arrow' twice and 'enter' once to open the 'save-as' dialogue box!!

ControlSend($winTitle, "", "[Class:DirectUIHWND]", "{DOWN}", 0)

ControlSend($winTitle, "", "[Class:DirectUIHWND]", "{DOWN}", 0)

ControlSend($winTitle, "", "[Class:DirectUIHWND]", "{ENTER}", 0)

EndFunc

I'm brand new to autoIt, but I suspect something in here might be used to create a more tidy function for manipulating the IE9 navigation toolbar

http://msdn.microsoft.com/en-us/library/jj206442(v=vs.85).aspx

Maybe the 'download manager' interface?

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