M4th3u534 Posted April 23, 2013 Share Posted April 23, 2013 (edited) Hello guys, i need some help on this: I got a script that i want it to click on every link on IExplorer only if the the link is NOT named "Example1". Like this: Got a link at a webpage and it says "Example1" and i want to click every link except that one.. All others are included.. If you guys don't understand what i want tell me and i will try to explain it again. Thanks everybody. Edited April 23, 2013 by M4th3u534 Link to comment Share on other sites More sharing options...
water Posted April 23, 2013 Share Posted April 23, 2013 Welcome to AutoIt and the forum! Can you please tell us why you need to click all links on a page? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki  Link to comment Share on other sites More sharing options...
M4th3u534 Posted April 23, 2013 Author Share Posted April 23, 2013 Thanks, and the reason is that i need to test multiple links on my website but not this one "Example1".. You think you can help me? Link to comment Share on other sites More sharing options...
water Posted April 23, 2013 Share Posted April 23, 2013 Which browser do you use? Internet Explorer? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki  Link to comment Share on other sites More sharing options...
M4th3u534 Posted April 23, 2013 Author Share Posted April 23, 2013 I use chrome actually but for AutoIt im using Internet Explorer... Link to comment Share on other sites More sharing options...
water Posted April 23, 2013 Share Posted April 23, 2013 For Internet Explorer there comes a UDF with AutoIt. Funktion _IELinkGetCollection returns a collection of all links. Loop through the collection and "click" on the URLs. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki  Link to comment Share on other sites More sharing options...
M4th3u534 Posted April 23, 2013 Author Share Posted April 23, 2013 You wouldnt have any little example to show me would you ? sorry for bothering you that much .. Link to comment Share on other sites More sharing options...
somdcomputerguy Posted April 23, 2013 Share Posted April 23, 2013 The Help file has example code for just about every function in it. There is also examples in the Wiki. - Bruce /*somdcomputerguy */Â If you change the way you look at things, the things you look at change. Link to comment Share on other sites More sharing options...
M4th3u534 Posted April 23, 2013 Author Share Posted April 23, 2013 Hey guys im back and i think i got it working the only thing that isnt right is that it always clicks in the same link instead of going to the next one.. any ideas to solve this? this is what im going with so far.. Local $sMyString = $aArray[1] Local $oLinks = _IELinkGetCollection($oIE) For $oLink In $oLinks Local $sLinkText = _IEPropertyGet($oLink, "innerText") If Not StringInStr($sLinkText, $sMyString) Then _IEAction($oLink, "click") ExitLoop EndIf Next Link to comment Share on other sites More sharing options...
water Posted April 23, 2013 Share Posted April 23, 2013 I see nothing wrong with the script. Looks exactly like the example in _IELinkClickByText, My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki  Link to comment Share on other sites More sharing options...
M4th3u534 Posted April 23, 2013 Author Share Posted April 23, 2013 Well it is working but not as i want it to.. It is not click the link named "Example1" but it only clicks in the first link in the page and keep repeating that.. doesnt follow on to the next links.. Link to comment Share on other sites More sharing options...
jdelaney Posted April 23, 2013 Share Posted April 23, 2013 I'm assuming that the link will open a new page...the objects in the collection will no longer be present if you navigate away from the page that houses them...you'll need to go another route. You might just want to read all the href's of the links, and navigate to those directly in a loop (_ienavigate) 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 More sharing options...
M4th3u534 Posted April 23, 2013 Author Share Posted April 23, 2013 It opens in the same tab, then it goes back and opens the same link again.. but i will try what you said, thanks everyone for the support. Link to comment Share on other sites More sharing options...
jdelaney Posted April 23, 2013 Share Posted April 23, 2013 (edited) By 'open a new page' I mean it navigates to a new page (yes, the same tab). Please let me know if it does/does not. Edited April 23, 2013 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 More sharing options...
M4th3u534 Posted April 23, 2013 Author Share Posted April 23, 2013 Hey jdelaney can you tell me how to do that what you're sayin.. sorry im not an advanced user ;/ Link to comment Share on other sites More sharing options...
M4th3u534 Posted April 24, 2013 Author Share Posted April 24, 2013 Another thing guys.. Can you tell me if it is possible to click in a link if a part of the link is like "example1"? something like this: the full link is "http://www.example.com/example1.html" - But i want to click any link where "example1" appears u know what im sayin? Thanks guys! Link to comment Share on other sites More sharing options...
jdelaney Posted April 24, 2013 Share Posted April 24, 2013 (edited) using your above example Local $oLinks = _IELinkGetCollection($oIE) For $oLink In $oLinks $href = $oLink.href If StringInStr($href, "example1") Then _IEAction($oLink, "click") EndIf Next Edited April 24, 2013 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 More sharing options...
M4th3u534 Posted May 7, 2013 Author Share Posted May 7, 2013 using your above example Local $oLinks = _IELinkGetCollection($oIE) For $oLink In $oLinks $href = $oLink.href If StringInStr($href, "example1") Then _IEAction($oLink, "click") EndIf Next Sorry for the delay, yes this will do what im looking for.. I was just wondering if this _IEAction($oLink, "click") could be used to open the link in another tab? Thanks in advance! Link to comment Share on other sites More sharing options...
M4th3u534 Posted May 7, 2013 Author Share Posted May 7, 2013 Anyone? i need to know how to open the $oLink in another tab.. thanks Link to comment Share on other sites More sharing options...
careca Posted May 8, 2013 Share Posted May 8, 2013 Have you tried going to the options and see if there's an option to open all links in new tabs? I don't know, since i don't use IE. Spoiler Renamer - Rename files and folders, remove portions of text from the filename etc. GPO Tool - Export/Import Group policy settings. MirrorDir - Synchronize/Backup/Mirror Folders BeatsPlayer - Music player. Params Tool - Right click an exe to see it's parameters or execute them. String Trigger - Triggers pasting text or applications or internet links on specific strings. Inconspicuous - Hide files in plain sight, not fully encrypted. Regedit Control - Registry browsing history, quickly jump into any saved key. Time4Shutdown - Write the time for shutdown in minutes. Power Profiles Tool - Set a profile as active, delete, duplicate, export and import. Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes. NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s. IUIAutomation - Topic with framework and examples Au3Record.exe Link to comment Share on other sites More sharing options...
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