Imranimi Posted February 19, 2019 Share Posted February 19, 2019 I have implemented all these loops (Do, For, while) but unable to figure the right way. Thanks to AutoIT-Help Document & @Nine to support me in completing my script. I am sharing the script: < $oIE1 = _IECreate("http://repl.flexlink.com/os/products.htm") Sleep(3000) Global $oInputs = _IETagNameGetCollection($oIE1, "a") For $oInput In $oInputs if $oInput.title = "More information" then Global $oIELink = $oInput ExitLoop endif Next MsgBox($MB_SYSTEMMODAL, "Product Name", $oIELink.href) Global $oIE2 = _IECreateTab ($oIE1, $oIELink.href) Func _IECreateTab (ByRef $oIE, $url) Local $Count = 0, $oIE2 $oIE.Navigate ($url, $ie_newtab) $oIE2 = _IEAttach($url, "url") _IELoadWait ($oIE2, 300) return $oIE2 EndFunc MsgBox($MB_SYSTEMMODAL, "Accessories", "Switch to Next Product") Sleep(3000) Send("^w") > Link to comment Share on other sites More sharing options...
faustf Posted February 20, 2019 Share Posted February 20, 2019 (edited) please use tag for insert a code sleep(3000) is not much correct use _IELoadWait is mcuh better usally and explain what your script must should do Edited February 20, 2019 by faustf Imranimi 1 Link to comment Share on other sites More sharing options...
Imranimi Posted February 20, 2019 Author Share Posted February 20, 2019 @faustf Thanks, i will rectify my script with _IELoadWait I actually need to open all the hypertext with title "More information" one by one in new tab. The above script is working fine with single move but i need to make it in loop & it should start with the next hypertext on completing the loop. I am sharing the screenshot below, my above script is taking the detail of 1st hypertext "WKTL150" with title "More information" and opens in new-tab, my target is when i close the 1st hypertext-tab & come to this home-page it should open the 2nd-hypertext in new-tab & then close, then open & close 3rd, 4th & 5th one by one. Link to comment Share on other sites More sharing options...
faustf Posted February 20, 2019 Share Posted February 20, 2019 count how many hypertext have in a page put in array and cicle with for Imranimi and Fr33b0w 2 Link to comment Share on other sites More sharing options...
Imranimi Posted February 20, 2019 Author Share Posted February 20, 2019 @faustf, Thanks, Hypertext are 464 in number & Please notify me the specific array command with example, if possible. Link to comment Share on other sites More sharing options...
IAMK Posted February 20, 2019 Share Posted February 20, 2019 https://www.autoitscript.com/wiki/Arrays https://www.autoitscript.com/autoit3/docs/keywords/For.htm These should give examples on what faust has mentioned. Imranimi 1 Link to comment Share on other sites More sharing options...
faustf Posted February 20, 2019 Share Posted February 20, 2019 (edited) control if array have only hypertext that you interest _arraydisplay($array) if yes do a loop classical is For $i=0 to ubound($array) -1 if no clean before array or much better use regexp for take only a correct link but with out browse page is difficult give a suggest Edited February 20, 2019 by faustf Imranimi 1 Link to comment Share on other sites More sharing options...
Imranimi Posted February 20, 2019 Author Share Posted February 20, 2019 @IAMK, i need to select the specific array script, can you give me suggestion to fill my array with all 450 number of products. (All the Products have hypertext-title = "More information". Link to comment Share on other sites More sharing options...
Imranimi Posted February 22, 2019 Author Share Posted February 22, 2019 On 20/02/2019 at 5:48 PM, faustf said: control if array have only hypertext that you interest _arraydisplay($array) if yes do a loop classical is For $i=0 to ubound($array) -1 if no clean before array or much better use regexp for take only a correct link but with out browse page is difficult give a suggest @faustf, Bundle of thanks for pointing out this solution, can you make an example script of the above point. as i am checking in help i am unable to find the exact example on handling hypertexts in the array & making them in loop. If you give me a way for handling more than 3 hypertext in array & open them in next tab one by one in sequence. Link to comment Share on other sites More sharing options...
faustf Posted February 23, 2019 Share Posted February 23, 2019 this is a possible example what i spoken #include <IE.au3> #include <MsgBoxConstants.au3> #include <StringConstants.au3> #include <InetConstants.au3> #include <WinAPI.au3> #include <WinAPIsysinfoConstants.au3> #include <WindowsConstants.au3> #include <GDIPlus.au3> #include <Misc.au3> #include <INet.au3> ;#include <Excel.au3> #include <File.au3> #include <Array.au3> #include <Date.au3> #include <Misc.au3> #include <Debug.au3> Local $path = "https://www.immobiliare.it/ricerca.php?idCategoria=1&idContratto=1&idTipologia=&sottotipologia=&idTipologiaStanza=&idFasciaPrezzo=&idNazione=IT&idRegione=&idProvincia=&idComune=&idLocalita=&idAreaGeografica=&prezzoMinimo=&prezzoMassimo=&balcone=&balconeOterrazzo=&boxOpostoauto=&stato=&terrazzo=&bagni=&mappa=&foto=&superficie=&superficieMinima=&superficieMassima=&raggio=&locali=&localiMinimo=&localiMassimo=&criterio=rilevanza&ordine=desc&map=0&tipoProprieta=&arredato=&inAsta=&noAste=&aReddito=&fumatore=&animali=&franchising=&flagNc=&gayfriendly=&internet=&sessoInquilini=&vacanze=&categoriaStanza=&fkTipologiaStanza=&ascensore=&classeEnergetica=&verticaleAste=&occupazioneInquilini=&pag=1&vrt=43.84357086564766,10.488960742950441;43.84241015467616,10.494132041931154;43.84333872526002,10.493659973144533;43.84487083512528,10.49524784088135;43.84627910342516,10.49275875091553;43.8465421828286,10.49123525619507;43.845830318235556,10.490291118621828;43.84578389198876,10.488703250885011" $oIE = _IECreate($path, 0, 1, 1, 1) ; <--- 0011 invisible explorer <--- 0111 visible explorer _IELoadWait($oIE, 1, 1) $sGHtmlPag = _IEBodyReadHTML($oIE) Local $aLLinkInserz = StringRegExp($sGHtmlPag, '(?i)<a title=".+?" id=".+?" href="(.*?)"', 3) _ArrayDisplay($aLLinkInserz) for $i=0 To ubound ($aLLinkInserz) -1 ; this is a simple for with array ; here you can open in tab (but i dont like )---> url 1...... to 10 --> $aLLinkInserz[$i] ; or open in new window ; and do much more ...... ; enjoy. Next Imranimi and Fr33b0w 1 1 Link to comment Share on other sites More sharing options...
Imranimi Posted February 26, 2019 Author Share Posted February 26, 2019 @faustf Thanks but the above example is too much complicated can you simplify it with Autoit-Website using href in array & share please Link to comment Share on other sites More sharing options...
faustf Posted February 26, 2019 Share Posted February 26, 2019 is not complicated , where you find difficult ? Link to comment Share on other sites More sharing options...
Imranimi Posted February 26, 2019 Author Share Posted February 26, 2019 @faustf, I need to stick to href.title (which is similar) in all links, i need to store them in array & need to open one-by-one in new-tabs. < #include <IE.au3> #include <Excel.au3> #include <MsgBoxConstants.au3> #include <StringConstants.au3> #include <Array.au3> #include <ArrayDisplayInternals.au3> #include <InetConstants.au3> #include <WinAPI.au3> #include <WinAPIsysinfoConstants.au3> #include <WindowsConstants.au3> #include <GDIPlus.au3> #include <Misc.au3> #include <Inet.au3> #include <File.au3> #include <Date.au3> #include <Misc.au3> #include <Debug.au3> Global $ProductName Global Const $ie_newtab = 0x0800 Global $arr[30] ; open Flexlink Website in Internet Explorer $oIE1 = _IECreate("http://repl.flexlink.com/os/products.htm?clicktype=A") _IELoadWait($oIE1, 1, 1) $sHtmlpag = _IEBodyReadHTML($oIE1) Global $oInputs = _IETagNameGetCollection($oIE1, "a") Global $array = StringRegExp($oInputs, "More information", $STR_REGEXPARRAYGLOBALFULLMATCH) _ArrayDisplay($array) For $oInput In $oInputs if $oInput.title = "More information" then Global $oIELink = $oInput ExitLoop endif Next MsgBox($MB_SYSTEMMODAL, "Product Name", $oIELink.href) Global $oIE2 = _IECreateTab ($oIE1, $oIELink.href) Func _IECreateTab (ByRef $oIE, $url) Local $Count = 0, $oIE2 $oIE.Navigate ($url, $ie_newtab) $oIE2 = _IEAttach($url, "url") _IELoadWait ($oIE2, 300) return $oIE2 EndFunc Send("#{LEFT}", 0) ;Send("{enter}") MsgBox($MB_SYSTEMMODAL, "Chains and Accessories", $oIELink.title) Sleep(4000) Send("^w") Sleep(3000) Func Terminate() Exit 0 EndFunc > The above is not working for me Link to comment Share on other sites More sharing options...
faustf Posted February 26, 2019 Share Posted February 26, 2019 please use tag when insert a code is a simbol < > Link to comment Share on other sites More sharing options...
faustf Posted February 26, 2019 Share Posted February 26, 2019 when you point in here _IECreate("http://repl.flexlink.com/os/products.htm?clicktype=A") return web page The session is invalid or has expired, please login again. Redirecting to login page in 10 seconds... My FlexLink you must automate a login first , and after navigate , in this link $oIE1 = _IENavigate("http://repl.flexlink.com/os/products.htm?clicktype=A") _IELoadWait($oIE1, 1, 1) not use send study the udf _IE , you find in help F1 Imranimi 1 Link to comment Share on other sites More sharing options...
Imranimi Posted February 27, 2019 Author Share Posted February 27, 2019 @faustf, I will automate a login page but my concern is the one which i asked about array as asked before, thanks Link to comment Share on other sites More sharing options...
faustf Posted February 27, 2019 Share Posted February 27, 2019 i just show you how to catch link , and store in array . Don't concern, try ...., do mistake, .... learn , increase your skill , me and Forum we will happy to help you , you have just a good example for what you do , study ... Link to comment Share on other sites More sharing options...
Subz Posted February 27, 2019 Share Posted February 27, 2019 The following should work without an array (untested). #include <IE.au3> Const $navOpenInNewTab = 0x0800 Local $oIE = _IECreate("http://repl.flexlink.com/os/products.htm?clicktype=A", 1) _IELoadWait($oIE) Local $oLinks = _IETagNameGetCollection($oIE, "a") For $oLink In $oLinks If $oInput.title = "More information" Then $oIE.Navigate2($oInput.href, $navOpenInNewTab) EndIf Next Link to comment Share on other sites More sharing options...
Imranimi Posted February 27, 2019 Author Share Posted February 27, 2019 @Subz Thanks, I had already done without array & its working fine but i am having trouble to fetch all the href of web-page & save them in array & open them in new-tab one-by-none. Link to comment Share on other sites More sharing options...
Subz Posted February 27, 2019 Share Posted February 27, 2019 The code above should open all links on the page Imranimi 1 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