TehWhale Posted August 22, 2008 Posted August 22, 2008 (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 August 24, 2008 by Alienware
Champak Posted August 22, 2008 Posted August 22, 2008 (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 August 22, 2008 by Champak
TehWhale Posted August 22, 2008 Author Posted August 22, 2008 Did you read my first sentance, get the link for the download button!
Champak Posted August 22, 2008 Posted August 22, 2008 (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 August 22, 2008 by Champak
TehWhale Posted August 22, 2008 Author Posted August 22, 2008 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."
TehWhale Posted August 22, 2008 Author Posted August 22, 2008 IE...That's why im using _IE functions.
Champak Posted August 22, 2008 Posted August 22, 2008 (edited) 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=19368You need to look at _IE_Introduction(). Edited August 22, 2008 by Champak
TehWhale Posted August 22, 2008 Author Posted August 22, 2008 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=19368You 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...
TehWhale Posted August 22, 2008 Author Posted August 22, 2008 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?
DaleHohm Posted August 22, 2008 Posted August 22, 2008 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
maxlarue Posted August 22, 2008 Posted August 22, 2008 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.
TehWhale Posted August 22, 2008 Author Posted August 22, 2008 Last question: You're likely using Vista right? See the remarks in the helpfile for _IECreate.Previous question: _IELinkClickByText($oIE, "Download")DaleThanks 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!
TehWhale Posted August 23, 2008 Author Posted August 23, 2008 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")NextThe: "This step will be shown below" is here.I have already naviagated to this page: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.
TehWhale Posted August 23, 2008 Author Posted August 23, 2008 I saw DaleHolm looking at this topic for 45 minutes, exciting and awaiting his response, but there wasn't a responce.
TehWhale Posted August 23, 2008 Author Posted August 23, 2008 Still wondering if I could get help with this.
DaleHohm Posted August 23, 2008 Posted August 23, 2008 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
TehWhale Posted August 23, 2008 Author Posted August 23, 2008 (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 August 23, 2008 by Alienware
DaleHohm Posted August 23, 2008 Posted August 23, 2008 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
TehWhale Posted August 23, 2008 Author Posted August 23, 2008 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.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now