Jump to content

_IEAction($iLink, "click") pauses when clicking on a download link.


Recommended Posts

I am stuck. Don't know what's going on. Any help is much appreciated.

My function calls a link on one page that loads a page with a download link on it.

I am running in debug mode, and at the point where the download link is clicked, my console just shows the _IEAction($iLink, "click"), and nothing below... it's like it just stops. When I cancel out or complete the download manually, the script then resumes. Is there something I can do about this?

Environment:

Windows Server 2008 R2 Standard 64bit

Internet Explorer 8.0.7601.17514

The function in question is as follows:

Func _DownLoadIt($FileVar)

Local $sString = $FileVar
Local $oLinks = _IELinkGetCollection($oIE)
For $oLink In $oLinks
    Local $sLinkText = _IEPropertyGet($oLink, "innerText")
    If StringInStr($sLinkText, $sString) Then
      _IEAction($oLink, "click")
      _IELoadWait($oIE)
      Sleep(2000)
      Local $sMyString = "Download"
      Local $iLinks = _IELinkGetCollection($oIE)
      For $iLink In $iLinks
        Local $sLinkText2 = _IEPropertyGet($iLink, "innerText")
        If StringInStr($sLinkText2, $sMyString) Then
          _IEAction($iLink, "click")
          MsgBox(0,"test","testbox")
          WinWaitActive("File Download","",2)
          Send("!S")
          WinWaitActive("Select","",3)
          Send("+{TAB 2}{UP 3}{ENTER}")
          Send("!S")
          ExitLoop
        EndIf
      Next
  EndIf
Next
_IEAction($oIE,"Back")
EndFunc

Thanks again,

T]-[R/\K

Link to comment
Share on other sites

The same thing happens when a dialog is opened when you send a commandid on a ToolbarWindow32.

look into the help file for "Command Line Parameters"

specifically, to execute a line of script where you perform the click:

Form4: AutoIt3.exe [/ErrorStdOut] /AutoIt3ExecuteLine "command line"

Execute one line of code.

To execute a single line of code, use the command:

Run(@AutoItExe & ' /AutoIt3ExecuteLine "MsgBox(0, ''Hello World!'', ''Hi!'')"')

That way, a second process clicks the link, and is frozen, while your script will proceed to the next line (use a run command, not a runwait)

Edited by jdelaney
IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Link to comment
Share on other sites

Most common solution is getting a reference to the link with _IELinkGetCollection and then using the *second* example for _IEAction.

Dale

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

@JDelaney,

Thank you for your suggestion, I can see the logic, so it should work.

@Dan,

Unfortunately, the web page to which I am going has content that is dynamically changed daily and does not have a static href reference.

@Dale,

I do not understand your meaning.

I am referencing a collection on one page, and then clicking on that link, then referencing the resulting pages collection and clicking on it's link. Is that the scenario to which you are referencing? If there is a better way to do it, I am definitely open to learning. I have been told before that my way of thinking is not normal.

Thank again for all of your help :)

Link to comment
Share on other sites

Did you look at the second example for _IEAction?

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

@Dale,

I did, but unfortunately, I cannot see the correlation between the example references and the web page so that I can understand what I need to change to make it relevant.

I have been going through the help file for _IEGetObjByName, _IEPropertyGet, ControlSend and ControlClick to try to make sense of it, but it is slow going. I will get there, though.

Thank you for your help and direction.

Link to comment
Share on other sites

Did you also read the comments associated with example 2?

Instead of _IEAction click, use _IEAction focus and then ControlSend. This allows your script to continue to run and not be trapped waiting for control to return after the click.

Dale

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

Unfortunately, the web page to which I am going has content that is dynamically changed daily and does not have a static href reference.

Yes, I understand that, which is why you would capture the link's URL each time that you attempt to download the file. This may not work in your situation, but I was able to avoid the issues you are having by using this method.

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