dickjones007 Posted May 5, 2011 Share Posted May 5, 2011 first of all i am total newb but learning fast so my mission is to make a button to run part of scipt in $oIE = _IECreateEmbedded () what i cant figure out is how to run following script specified number of time. i can specify it maybe though input box? Select Case $msg = $GUI_Button_Clickvid MouseClick("primary",50,70) MouseWheel("down",9) Dim $ycoord = 65 While $ycoord Sleep(300) MouseClick("primary",130,$ycoord) Sleep(5000) MouseClick("primary",130,$ycoord) Sleep(3000) $ycoord +=29 WEnd EndSelect my next mission would be to extract anchor link list from pages source (and put it in a table for further copy paste) like its done in IEbulder 1.0.4 (i guess you know about it, check attached file for example). i think that would be it for a start. Link to comment Share on other sites More sharing options...
smartee Posted May 5, 2011 Share Posted May 5, 2011 hi dickjones, A simple loop will do the trick look at this example:#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 362, 240, 205, 147) $Button1 = GUICtrlCreateButton("Click me", 8, 8, 345, 25, $WS_GROUP) $Edit1 = GUICtrlCreateEdit("", 8, 40, 345, 193) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 $number = Number(InputBox(@ScriptName, "Enter number of lines to add")) For $i = 1 To $number GUICtrlSetData($Edit1, GUICtrlRead($Edit1) & "Some text." & @CRLF) Next EndSwitch WEnd Hope this helps -smartee Link to comment Share on other sites More sharing options...
dickjones007 Posted May 5, 2011 Author Share Posted May 5, 2011 yes that was extremely helpfulthanks...my next mission would be to extract anchor link list from pages source ...this quote of mine was also part of the problem. i want to replace your "Some text." with anchor links list.i failed to extract the code from ultimate autoit script collection.can i get any help on that? Link to comment Share on other sites More sharing options...
dickjones007 Posted May 5, 2011 Author Share Posted May 5, 2011 update: i found this code for list i am not certain how to modify it to display ONLY links in anchor code #include <Array.au3> #include <IE.au3> $Primary_url = "http://buxp.info/viewvids.php" ; Any URL $IE = _IECreate($Primary_url,0,1,1) $pagesource = _IEBodyReadHTML($IE) $array = StringRegExp($pagesource,'(?:<A href=")(http.*?)(?:">)(.*?)(?:</A>)',3) _ArrayDisplay($array, "Test") Link to comment Share on other sites More sharing options...
smartee Posted May 5, 2011 Share Posted May 5, 2011 hi again, Try this#include <IE.au3> #include <Array.au3> $oIE = _IECreate("http://www.gnu.org/software/wget/manual/wget.html") $oLinks = _IELinkGetCollection ($oIE) $iNumLinks = @extended MsgBox(0, "Link Info", $iNumLinks & " links found") For $oLink In $oLinks ;show only Anchor links If StringInStr($oLink.href,"#") Then MsgBox(0, "Link Info: "&$oLink.innerText, $oLink.href) EndIf Next Hope this clears up some things -smartee Link to comment Share on other sites More sharing options...
dickjones007 Posted May 5, 2011 Author Share Posted May 5, 2011 thanks for that, its late now i will play with it tomorrow and let you know how it goes Link to comment Share on other sites More sharing options...
dickjones007 Posted May 8, 2011 Author Share Posted May 8, 2011 hi again, Try this#include <IE.au3> #include <Array.au3> $oIE = _IECreate("http://www.gnu.org/software/wget/manual/wget.html") $oLinks = _IELinkGetCollection ($oIE) $iNumLinks = @extended MsgBox(0, "Link Info", $iNumLinks & " links found") For $oLink In $oLinks ;show only Anchor links If StringInStr($oLink.href,"#") Then MsgBox(0, "Link Info: "&$oLink.innerText, $oLink.href) EndIf Next Hope this clears up some things -smartee this code is great for what i want but i cant get it to work the way i want. id this code links come one by one and cannot be copied but i need to get in a list that can copy paste each line Link to comment Share on other sites More sharing options...
smartee Posted May 8, 2011 Share Posted May 8, 2011 hi, Perhaps you may be interested in FileWrite(). Here's a quick implementation:#include <IE.au3> #include <Array.au3> $linkFile = @ScriptDir & "\AnchorLinks.txt" SplashTextOn(@ScriptName, "Please wait..", 200, 50) $oIE = _IECreate("http://www.gnu.org/software/wget/manual/wget.html", 0, 0) $oLinks = _IELinkGetCollection($oIE) $iNumLinks = @extended $linkFileHandle = FileOpen($linkFile, 1) ;MsgBox(0, "Link Info", $iNumLinks & " links found") FileWriteLine($linkFileHandle, $iNumLinks & " links found") For $oLink In $oLinks ;show only Anchor links If StringInStr($oLink.href, "#") Then FileWriteLine($linkFileHandle, $oLink.href) ;MsgBox(0, "Link Info: " & $oLink.innerText, $oLink.href) EndIf Next FileClose($linkFileHandle) _IEQuit($oIE) SplashOff() MsgBox(64, @ScriptName, $iNumLinks & " links saved to """ & $linkFile & """") Hope this helps, -smartee Link to comment Share on other sites More sharing options...
dickjones007 Posted May 8, 2011 Author Share Posted May 8, 2011 (edited) hi, Perhaps you may be interested in FileWrite(). Here's a quick implementation:#include <IE.au3> #include <Array.au3> $linkFile = @ScriptDir & "\AnchorLinks.txt" SplashTextOn(@ScriptName, "Please wait..", 200, 50) $oIE = _IECreate("http://www.gnu.org/software/wget/manual/wget.html", 0, 0) $oLinks = _IELinkGetCollection($oIE) $iNumLinks = @extended $linkFileHandle = FileOpen($linkFile, 1) ;MsgBox(0, "Link Info", $iNumLinks & " links found") FileWriteLine($linkFileHandle, $iNumLinks & " links found") For $oLink In $oLinks ;show only Anchor links If StringInStr($oLink.href, "#") Then FileWriteLine($linkFileHandle, $oLink.href) ;MsgBox(0, "Link Info: " & $oLink.innerText, $oLink.href) EndIf Next FileClose($linkFileHandle) _IEQuit($oIE) SplashOff() MsgBox(64, @ScriptName, $iNumLinks & " links saved to """ & $linkFile & """") Hope this helps, -smartee wow, it apears i WAS intersted in that and i didnt even know it thinking sometimes gets blocked when working long into the night can this be further upgraded to tell the script to collect only HREFs from links on the page that only contain exact word match. for example if a HTML page contains following link list: red RED blue blue red RED BLUE RED BLUE can the script extract only RED links, not red, BLUE and blue. or to select all other links that do not contain RED. Edited May 8, 2011 by dickjones Link to comment Share on other sites More sharing options...
smartee Posted May 8, 2011 Share Posted May 8, 2011 Hi again, can this be further upgraded to tell the script to collect only HREFs from links on the page that only contain exact word matchOf course, just use the StringInStr() function as I have to filter the URLs. For example to test if a URL contains the string "RED" and the character "#" (case sensitive), use something like ;Write only links containing the character "#" and the word "RED" If StringInStr($oLink.href, "#") And StringInStr($oLink.href, "RED", 1) Then FileWriteLine($linkFileHandle, $oLink.href) EndIf Hope this helps, -smartee Link to comment Share on other sites More sharing options...
dickjones007 Posted May 8, 2011 Author Share Posted May 8, 2011 Hi again, Of course, just use the StringInStr() function as I have to filter the URLs. For example to test if a URL contains the string "RED" and the character "#" (case sensitive), use something like ;Write only links containing the character "#" and the word "RED" If StringInStr($oLink.href, "#") And StringInStr($oLink.href, "RED", 1) Then FileWriteLine($linkFileHandle, $oLink.href) EndIf Hope this helps, -smartee greately, now im going back to my own workshop 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