Jump to content

[solved]quirk with the buildin(?) {alert("")} in IE


Recommended Posts

well quick question actually. this is some quick'n dirty code to demonstrate my problem. when the link "Multi-Upload" is pressed by hand, the popup function works like a charm, but when i click it with the commented line it does nothing. any other way to get around this annoying popup?

#include <IE.au3>
$ie = _IECreate("rapidshare.com")
Opt("WinTitleMatchMode", 4)
Global $sPopup = "[CLASS:#32770; TITLE:Windows Internet Explorer;]"
Global $sButton = "[CLASSNN:Button1; TEXT:OK]"
AdlibEnable("popup", 500)
;_IELinkClickByText($ie, "Multi-Upload")


While 1
    Sleep(1000)
WEnd

Func popup()
    If WinExists($sPopup) Then 
        ControlClick($sPopup, "", $sButton)
    EndIf
EndFunc

and sorry but the autoit code wrapping doesn't work here :D

Edited by luzif3r
Link to comment
Share on other sites

This is a case where AdLib won't help you. Add #AutoIt3Wrapper_Run_Debug_Mode=Y to your code and you'll see what I mean.

_IELinkClickByText($ie, "Multi-Upload") executes and control is not returned to your script until the popup has been dismissed.

See the example for _IEAction for a workaround (hint: you need to get a reference to the Multi-Upload link with _IELinkGetCollection, give it focus with _IEAction and then SEND {Enter})

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

Thanks man. you sure help out a lot of people from what ive read and even at night :D

edit: deleted my idiotic post. working code:

#include <Array.au3>
#include <IE.au3>
#include <String.au3>
$ie = _IECreate("rapidshare.com")
$hie = _IEPropertyGet($ie, "hwnd")
Opt("WinTitleMatchMode", 4)
Global $sPopup = "[CLASS:#32770; TITLE:Windows Internet Explorer;]"
Global $sButton = "[CLASSNN:Button1; TEXT:OK]"
AdlibEnable("popup", 500)
$oLinks = _IELinkGetCollection($ie)
For $oLink In $oLinks
    If StringInStr($oLink.href, "http://rapidshare.com/#") Then
        _IEAction($oLink, "focus")
        ControlSend($hie, "", "[CLASS:Internet Explorer_Server]", "{ENTER}")
    EndIf
Next
;WinWait($sPopup)

While 1
    Sleep(100)
WEnd

Func popup()
    If WinExists($sPopup) Then
        ControlClick($sPopup, "", $sButton)
    EndIf
EndFunc
Edited by luzif3r
Link to comment
Share on other sites

Good job!

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

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