SugarBall Posted October 9, 2015 Share Posted October 9, 2015 Hey guys, hope you all are doing welli have this piece of code: Local $oAs = _IETagNameGetCollection($oIE, "a") For $oA In $oAs $sNumber1 = Execute("$oA.attributes.getNamedItem") $sNumber2 = Execute("$oA.attributes.getNamedItem") $sNumber3 = Execute("$oA.attributes.getNamedItem") $sNumber4 = Execute("$oA.attributes.getNamedItem") Next $sNumber1 = "Example1" $sNumber2 = "Example2" $sNumber3 = "Example3" $sNumber4 = "Example4" For $oA = $sNumber1 To $sNumber4 Step 1 Sleep(2000) _IEAction($oA, "click") Nextand i'd like to click this attributes one after another and for every one clicked i want to stop for 2 seconds... my problem is at the 'For...Next' function. Can anyone give a little help to my code? Link to comment Share on other sites More sharing options...
Damein Posted October 9, 2015 Share Posted October 9, 2015 A For statement using a "Step 1" increment is literally adding +1 to something. Use an Array instead of a variable. Something like... Dim $sNumber[5] = [4, "Example1", "Example2", "Example3", "Example4"] ; Assign 5 values, 0 = our count that we want For $i = 1 To $sNumber[0] ; $sNumber[0] = "4" which gives us our counter to go up to. MsgBox(0, "test", $sNumber[$i]) Next Most recent sig. I made Quick Launcher W/ Profiles Topic Movie Database Topic & Website | LiveStreamer Pro Website | YouTube Stand-Alone Playlist Manager: Topic | Weather Desktop Widget: Topic | Flash Memory Game: Topic | Volume Control With Mouse / iTunes Hotkeys: Topic | Weather program: Topic | Paws & Tales radio drama podcast mini-player: Topic | Quick Math Calculations: Topic Link to comment Share on other sites More sharing options...
SugarBall Posted October 9, 2015 Author Share Posted October 9, 2015 Thank you vey much for your help Damein. And should i go like this?Dim $sNumber[5] = [4, "Example1", "Example2", "Example3", "Example4"] ; Assign 5 values, 0 = our count that we want For $i = 1 To $sNumber[0] ; $sNumber[0] = "4" which gives us our counter to go up to. Sleep(5000) _IEAction($oA, "click") Next Link to comment Share on other sites More sharing options...
Damein Posted October 9, 2015 Share Posted October 9, 2015 (edited) No, sorry I only created the For code to give an example how the statement works.As for the IE functions I haven't really used much of them but I think you need to grab the objects and then assign them to an array. Check out this quick script I added from the Help File to assign variables and hopefully it helps. Global $Count = 0 #include <IE.au3> #include <MsgBoxConstants.au3> Local $oIE = _IE_Example("form") Local $oInputs = _IETagNameGetCollection($oIE, "input") Dim $sTxt[1000] ; Assign an array to allow population. Assign this higher if the site has more than 1000 objects. For $oInput In $oInputs $sTxt[$Count] = $oInput.type ; We are assigning each object to the array as we go $Count += 1 ; Add +1 to count so the above statement doesn't repeat itself Next For $i = 0 To $Count MsgBox(0, "Test", $sTxt[$i]) ; This is where you will add your clicks (I think, but like I said I don't use IE) but check out how it all functions to better help you understand the concepts. Next _IEQuit($oIE) Edited October 9, 2015 by Damein Most recent sig. I made Quick Launcher W/ Profiles Topic Movie Database Topic & Website | LiveStreamer Pro Website | YouTube Stand-Alone Playlist Manager: Topic | Weather Desktop Widget: Topic | Flash Memory Game: Topic | Volume Control With Mouse / iTunes Hotkeys: Topic | Weather program: Topic | Paws & Tales radio drama podcast mini-player: Topic | Quick Math Calculations: Topic Link to comment Share on other sites More sharing options...
Jfish Posted October 9, 2015 Share Posted October 9, 2015 (edited) Thank you vey much for your help Damein. And should i go like this?Dim $sNumber[5] = [4, "Example1", "Example2", "Example3", "Example4"] ; Assign 5 values, 0 = our count that we want For $i = 1 To $sNumber[0] ; $sNumber[0] = "4" which gives us our counter to go up to. Sleep(5000) _IEAction($oA, "click") Next For this example you don't need the $sNumber[0] element. Instead, use Ubound($sNumber)-1 to get the upper boundary of the array less 1 for a zero based index. Step 1 is the default increment for the loop so you would not need to include that unless you wanted the loop to increase by more than 1 (or a negative number if going backwards). If you remove $sNumber[0]=4 from the array it would still run four times using this snippet ... for $a=0 to Ubound($sNumber)-1 next Edited October 9, 2015 by Jfish Build your own poker game with AutoIt: pokerlogic.au3 | Learn To Program Using FREE Tools with AutoIt Link to comment Share on other sites More sharing options...
SugarBall Posted October 9, 2015 Author Share Posted October 9, 2015 (edited) Thanks very much Damein, this helps me a lot. and you too Jfish, i appreciate your help my regards Edited October 9, 2015 by SugarBall 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