jonathan2133 Posted September 7, 2006 Posted September 7, 2006 (edited) im trying to look at this internet explorer stuff, and its very hard to understand... i think i found the right thing but i dont know how to use it. I have a page that i want to search for an image that links to a specific location. If it exists, i want it to click it, and if it doesnt exist i want it to go to another location. How do i do this? what i think i need to use is _IEimgClick but i have absolutely no idea how it all works. If somone could generalize how to add what, i would apprieate it. Like terms like firstaddress, secondaddress, nameofimage, etc would be helpfull - Editing - Ok im adding more because im more convused. _IEImgClick ( ByRef $o_object, $s_linkText [, $s_mode = "src" [, $i_index = 0 [, $f_wait = 1]]] ) that mess is really confusing. So lets look at this. if i want it to click somthing, i type: _IEImgClick ( name-of-image, where-the-link-points, "src" OR "alt" OR "name", occurance-to-click, wait-for-page-to-load (0 or 1) ) Is that right? And if so, how do i tell it that if the link does not exist to click another link? Edited September 7, 2006 by jonathan2133
AzKay Posted September 7, 2006 Posted September 7, 2006 ; ******************************************************* ; Example 1 - Click on IMG by Alt text ; ******************************************************* ; #include <IE.au3> $oIE = _IE_Example ("basic") _IEImgClick ($oIE, "AutoIt Homepage Image", "alt") ; ******************************************************* ; Example 2 - Click on IMG by name ; ******************************************************* ; #include <IE.au3> $oIE = _IE_Example ("basic") _IEImgClick ($oIE, "AutoItImage", "name") ; ******************************************************* ; Example 3 - Click on IMG by src sub-string ; ******************************************************* ; #include <IE.au3> $oIE = _IE_Example ("basic") _IEImgClick ($oIE, "autoit_6_240x100.jpg", "src") ; ******************************************************* ; Example 4 - Click on IMG by full src string ; ******************************************************* ; #include <IE.au3> $oIE = _IE_Example ("basic") _IEImgClick ($oIE, "http://www.autoitscript.com/images/autoit_6_240x100.jpg") This? # MY LOVE FOR YOU... IS LIKE A TRUCK- #
jonathan2133 Posted September 7, 2006 Author Posted September 7, 2006 (edited) thats what im looking at, but i cant understand what its saying... I want to find an image in a page that links to a specific location, and if it exists i want the program to click it. If the image does not exist i want the program to click a different link. - editing- Ok i sort of get it now that im reading it again. But all that "_IEImgClick ( ByRef $o_object, $s_linkText [, $s_mode = "src" [, $i_index = 0 [, $f_wait = 1]]] )" stuff is confusing... so is there not a way to detect what an image is linking to? Edited September 7, 2006 by jonathan2133
AzKay Posted September 7, 2006 Posted September 7, 2006 thats what im looking at, but i cant understand what its saying... I want to find an image in a page that links to a specific location, and if it exists i want the program to click it. If the image does not exist i want the program to click a different link. - editing- Ok i sort of get it now that im reading it again. But all that "_IEImgClick ( ByRef $o_object, $s_linkText [, $s_mode = "src" [, $i_index = 0 [, $f_wait = 1]]] )" stuff is confusing... so is there not a way to detect what an image is linking to?$o_object Object variable of an InternetExplorer.Application, Window or Frame object $s_linkText Text to match the content of the attribute specified in $s_mode $s_mode Optional: specifies search mode src = (Default) match the url of the image name = match the name of the image alt = match the alternate text of the image $i_index Optional: If the img text occurs more than once, specify which instance you want by 0-based index $f_wait Optional: specifies whether to wait for page to load before returning 0 = Return immediately, not waiting for page to load 1 = (Default) Wait for page load to complete before returning I dont know about the detecting thing. # MY LOVE FOR YOU... IS LIKE A TRUCK- #
jonathan2133 Posted September 7, 2006 Author Posted September 7, 2006 dam. Is there a way to do what im trying to do? does anyone know? Is there a glossery of tearms that you found those in?
AzKay Posted September 7, 2006 Posted September 7, 2006 The helpfile? # MY LOVE FOR YOU... IS LIKE A TRUCK- #
jonathan2133 Posted September 7, 2006 Author Posted September 7, 2006 The helpfile?Lol duh man im dumb today...
jonathan2133 Posted September 7, 2006 Author Posted September 7, 2006 (edited) ok lol this might not make a lot of sense, because u need to log in, but here goes... #include <IE.au3> $oIE = _IECreate ("http://www.lego.com/eng/racers/challenge/home.asp");open website _IELoadWait ($oIE) mousemove(1033,296,0) mouseclick("left",1033,296,1,0) _IELoadWait ($oIE);This is clicking a link... mouseclick("left",920,820,1,0);Click another link _IELoadWait ($oIE) mouseclick("left",620,490,1,0);Click another link _IELoadWait ($oIE) send("{end}");Go to the bottom of the page ;this is where i get stuck... dont even know if any of this is working, but here goes... ;http://www.lego.com/eng/racers/challenge/race.asp?un=dronem37&tid=5&md=challenge <-- the link i want it to search for... an image will point to it. The image is named "P1_button_race.gif" in case it helps. ;Do... somthing? dont know yet. want it to look for said link, and if it finds it, click it. If it doesnt find it, then go to this address: http://www.lego.com/eng/racers/challenge/t3.asp?tid=5 ;until everything works? dont know... ;check somthing on the next page waiting for flash to load, then click a spot when it turns the right color Do $color = PixelChecksum ( 860, 817, 920, 845) Sleep(100) until $color = 453885520 MouseClick("left", 888, 830, 10, 1) sleep(100) ;thats all folks, repeat as necessissary like i said it doesnt make much sense. well it might. But you have to be logged in. Anyways, i get stuck at the most critical point. at the Do statment, i want it to search for the image that links to the specific location. If it fails, then go to the second link. If it succeeds, continue down the program. I dont think that im using the right command? maybe but man im getting confused. Edited September 7, 2006 by jonathan2133
jonathan2133 Posted September 7, 2006 Author Posted September 7, 2006 lol man i wish there was like a live chat or somthing that i could talk to people in. Maybe check the source if that link exists? is that possable? and if it does then go to that location? Since i know the location i dont need to "click" it i can just go there, but i have to wait till its avaliable or it wont work... Also is it possable to check the address of a website? like if i get redircted after the page has loaded is there a way to tell?
Valuater Posted September 7, 2006 Posted September 7, 2006 (edited) not loging in makes it more difficult... "Maybe check the source if that link exists? is that possable?".... Yes "and if it does then go to that location?"... Yes alot is possible you can find all the answers in help under the IE ( from the new Autoit release 3.2.0) here is a small example ; Read the contents of the body of a webpage and search for a string. If the string is found, replace it ; with a new string and write it back to the webpage. #include <IE.au3> $oIE = _IECreate() _IENavigate($oIE, "http://www.autoitscript.com/") $body = _IEBodyReadHTML($oIE) If StringInStr($body, "automation") Then MsgBox(0, "Success", "The string was found") $newbody = StringReplace($body, "automation", "AUTOMATION - Yeah!") _IEBodyWriteHTML($oIE, $newbody) Else MsgBox(0, "Fail", "The string was NOT found") EndIf Exit 8) Edited September 7, 2006 by Valuater
jonathan2133 Posted September 7, 2006 Author Posted September 7, 2006 wow... that sort of helps me... I try looking in the help file but unless i know what im looking for exactly i cant find it... so it makes it tough. I would have never thought of searching for a "string" but now that its here it makes sense. Ok i think i can work with this...
Valuater Posted September 7, 2006 Posted September 7, 2006 That and many.... many more great examples are in the inter-active... "Welcome to Autoit 1-2-3" ( in my signature below ) 8)
DaleHohm Posted September 7, 2006 Posted September 7, 2006 If I understand you properly, you know where you want to go and if there is a link to take you there you want to click it? Why not just use _IENavigate and go there? 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
jonathan2133 Posted September 8, 2006 Author Posted September 8, 2006 If I understand you properly, you know where you want to go and if there is a link to take you there you want to click it? Why not just use _IENavigate and go there?Dalethe reason is that i cant go to the location untill i am allowed to. If i try to go there too soon then i get redirected. The searching the code for text was great, it works wonders... im able to get this macro going with only one instance of relying on colors on the screen, and thats because its flash...which reminds me... is there a way to detect if shockwave stuff has loaded or anything like that? it would really help if i didnt need to rely on screen colors to click if i could detect if the flash is running and what it is doing. Any ideas?
DaleHohm Posted September 8, 2006 Posted September 8, 2006 which reminds me... is there a way to detect if shockwave stuff has loaded or anything like that? it would really help if i didnt need to rely on screen colors to click if i could detect if the flash is running and what it is doing. Any ideas?IE.au3 can help with that, but you need to use some raw DOM techniques to do it all. Consider this: $oObjects = _IETagNameGetCollection($oIE, "object") $FlashFound = False For $oObject in $oObjects If $oObject.classid = "d27cdb6e-ae6d-11cf-96b8-444553540000" Then $FlashFound = True Next ConsoleWrite("FlashFound: " & $FlashFound & @CR) Similar techniques can be used with embed and applet tags. 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
jonathan2133 Posted September 9, 2006 Author Posted September 9, 2006 woah... thats some heavy stuff. What about stuff inside the shockwave thing? (for lack of better tearm) Like for instance what im looking at its a game, and theres a series of clicks i can do by recording screen co-ords, but it would make it a whole lot easier if i could detect that part of the thing being triggered and advance it or somthing... or even if theres a way to speed up the shockwave "thing". Any other ideas?
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