Sign in to follow this  
Followers 0
TehWhale

[RESOLVED]_IELoadWait

21 posts in this topic

#1 ·  Posted (edited)

I'm making a map downloader for Warcraft III. It starts to go to this webpage:

http://www.epicwar.com/maps/1/

I know how to do that, naviagate and blah, but how to click the link that says Download: mapname, I need it to get that shortcut. How?

In other words, navigate to a page like: http://www.epicwar.com/maps/1/ find the download link, get that link, then Inetget, then go to the next page http://www.epicwar.com/maps/2/ and so on. I just need to know what function(s) will get me that link that will be different on every page.

Thanks for all the help guys!

I actually need help with _IELoadWait() now.

Having one more issue Dale!

CODE$ReA = _IELoadWait($Hwnd, 0, 6000)
    If $ReA = 0 Then _IEAction($Hwnd, "refresh")

I have this in my script. Occassionally, some of the "ad's" wont load, so I was using this. It wont refresh IE though. I also tried, If @Error then _IE....I want it to reload the page after 6 seconds.

Edited by Alienware

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

VERY raw outlook, I just happened to pass by and see this so here you go, although I don't really know what you mean by "get that text, then Inetget", but this should get you started.

Loop $i
   _IEAttach()
      if @error
           _IECreate()
      endif
   _IENavigate("http://www.epicwar.com/maps/" & $i & "/")
   _IELinkGetCollection ()
endloop
_IEQuit()

If you need more, I can try and help you later.

Edited by Champak

Share this post


Link to post
Share on other sites

Did you read my first sentance, get the link for the download button! ;)

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

I find it interesting that the first time I read the OP I didn't notice that...and your OP was edited AFTER I made my post. Anyway, you will still need _IELinkGetCollection () and probably _IETagNameGetCollection to determine a specific pattern that the download link falls in. You'll need firebug for firefox and whatever IE uses to see html markup.

EDIT: Then again I'm no expert in the IE functions, but I get by and can do what I need to.

Edited by Champak

Share this post


Link to post
Share on other sites

I find it interesting that the first time I read the OP I didn't notice that...and your OP was edited AFTER I made my post. Anyway, you will still need _IELinkGetCollection () and probably _IETagNameGetCollection to determine a specific pattern that the download link falls in. You'll need firebug for firefox and whatever IE uses to see html markup.

EDIT: Then again I'm no expert in the IE functions, but I get by and can do what I need to.

Well I've never used _IE functions before at all. I am clueless.

And what is this supposted to mean?

"You'll need firebug for firefox and whatever IE uses to see html markup."

Share this post


Link to post
Share on other sites

What browser are you using?

Share this post


Link to post
Share on other sites

IE...That's why im using _IE functions. ;)

Share this post


Link to post
Share on other sites

Get this: http://www.debugbar.com/

......I personally recommend firefox and using the firebug plug-in, it doesn't matter if you are using IE functions.

I haven't used it, but look at this: http://www.autoitscript.com/forum/index.php?showtopic=19368

You need to look at _IE_Introduction().

And what is that for and why do I need it?

This is very simple, on a page, just find a link with the name Download in it, and get the link. I didn't figure it would be this hard...

Share this post


Link to post
Share on other sites

Lets try something easier. How do I click a link on a page that has "Download" in it?

Why do everytime I run a _IECreate with normal parameters, it will attach one, and then create another and the non-attached one will be blank, and I never told it to attach?

Share this post


Link to post
Share on other sites

Last question: You're likely using Vista right? See the remarks in the helpfile for _IECreate.

Previous question: _IELinkClickByText($oIE, "Download")

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

Share this post


Link to post
Share on other sites

use the DOM. you can't look in IE.au3 for some examples of DOM usage

Dim $pages[3] = ["www.1.com", "www.2.com", "www.3.com"]
$ie = _IECreate("about:blank")

For $page in $pages
     $ie.navigate($page)

    $elements = $ie.document.getElementsByTagName("a")
    for $element in $elements
        if isobj($element.firstChild) then 
             if $element.firstChild.outerText = "Download" then
                 $element.click()
                 ;....
               ;....
            endif
        endif
    Next
Next

This should put you on the right path. read up on the DOM , (in any language - javascript uses it alot) to get more comfortable with using it.

Share this post


Link to post
Share on other sites

Last question: You're likely using Vista right? See the remarks in the helpfile for _IECreate.

Previous question: _IELinkClickByText($oIE, "Download")

Dale

Thanks DaleHohm, read on that, so I disabled Protection Mode. Now how, since I located the download link, how can I get the link for later use to InetGet it? Thanks Dale!

Share this post


Link to post
Share on other sites

Bump. Just to clarify what im looking for.

This program will start in a for/next loop like so:

$Hwnd = _IECreate()

For $i=1 To 60000

_IENavigate($Hwnd, "http://www.epicwar.com/maps/"&$i)

_IELoadWait($Hwnd)

(This step will be showed below)

InetGet($LinkLocation, @ProgramFilesDir & "\Warcraft III\Maps\Download\Map"&$i&".w3x")

Next

The: "This step will be shown below" is here.

I have already naviagated to this page:

Posted Image

And where there is a yellow oval around it, I need to get that path to the actual download so I can use InetGet afterwards. I check the link on each page because it will have "Download" in it, get the link, then InetGet().

Thank you for your help.

I hope I clarified enough.

Share this post


Link to post
Share on other sites

I saw DaleHolm looking at this topic for 45 minutes, exciting and awaiting his response, but there wasn't a responce.

Share this post


Link to post
Share on other sites

Still wondering if I could get help with this.

Share this post


Link to post
Share on other sites

Something like this:

$sLinkText = "the string in the link text"
$oLinks = _IELinkGetCollection($oIE)
For $oLink in $oLinks
    If String($oLink.outerText) = $sLinkText Then
        $sFile = $oLink.href
    EndIf
Next

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

Share this post


Link to post
Share on other sites

#18 ·  Posted (edited)

Thanks DaleHolm. I did this as a test, and it's saying that there is no such thing as $sFile.

#include <IE.au3>
$Hwnd = _IECreate()
For $i = 1 To 5
    _IENavigate($Hwnd, "http://www.epicwar.com/maps/" & $i)
    _IELoadWait($Hwnd)
    $sLinkText = "Download"
    $oLinks = _IELinkGetCollection($Hwnd)
    For $oLink In $oLinks
        If String($oLink.outerText) = $sLinkText Then
            $sFile = $oLink.href
        EndIf
    Next
    InetGet($sFile, @DesktopDir & "\" & $i & ".w3x")
Next

It gives me an error saying $sFile Undeclared variable.

Haha! Nevermind! Daleholm, you were using String! I need StringinStr! It works! Thanks so much DaleHolm!

A simple question that probably is very simple, but how would I change all: "%20" in text to a " " a space?

Edited by Alienware

Share this post


Link to post
Share on other sites

StringReplace()


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

Share this post


Link to post
Share on other sites

Having one more issue Dale!

$ReA = _IELoadWait($Hwnd, 0, 6000)
    If $ReA = 0 Then _IEAction($Hwnd, "refresh")

I have this in my script. Occassionally, some of the "ad's" wont load, so I was using this. It wont refresh IE though. I also tried, If @Error then _IE....I want it to reload the page after 6 seconds.

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