malkerian Posted April 6, 2014 Share Posted April 6, 2014 Dear Ladies and Gentlemen, I have a basic html table with 8 rows. I wish to use the first cell as a number for the amount of cycles to do a function. How do i get autoit to take the first value and make it do the function X many times. then if the function doesn't meet it conditions it moves down to row 2 and does the function again X many times. Example 1 2 4 10 5 12 7 16 The function repeats one for 1, then if it fails, repeats the function twice as it is 2 in row 2, for row 3 it repeats the function 4 times. Many Regards Malkerian Link to comment Share on other sites More sharing options...
TechCoder Posted April 6, 2014 Share Posted April 6, 2014 The function repeats one for 1, then if it fails, repeats the function twice as it is 2 in row 2, for row 3 it repeats the function 4 times. no function posted....... If you are trying to get someone to write this code for you (which looks a lot like a homework exercise.....) you will find little help here. If you are trying to get HELP on your code for things that don't work as you expect, etc., then post the code that doesn't work for you and you will find a LOT of help here. Link to comment Share on other sites More sharing options...
mikell Posted April 6, 2014 Share Posted April 6, 2014 Make an array $rows from the html table, then something like this should work As TechCoder said without more details we can only speak about a matter of concept Global $test = 0 For $i = 0 to UBound($rows)-1 For $k = 1 to $rows[$i] _run_func() If $test <> 0 Then Exitloop 2 Next Next Link to comment Share on other sites More sharing options...
malkerian Posted April 6, 2014 Author Share Posted April 6, 2014 The function is Func start() $Runner = Not $Runner While $Runner MouseClick("left",1176, 817,1) Sleep(1000) MouseClick("left",384,817,1) Sleep(1000) MouseClick("left",1397,980,1) Sleep(3000) WEnd EndFunc ;==>start Link to comment Share on other sites More sharing options...
malkerian Posted April 6, 2014 Author Share Posted April 6, 2014 I tried to merge the 2 together but it come sup with an error. #include <Array.au3> Local $avArray[10] Local $iRows = UBound($aArray, 1) ; Total number of rows. In this example it will be 10. $avArray[0] = "1" $avArray[1] = "2" $avArray[2] = "3" $avArray[3] = "4" $avArray[4] = "5" $avArray[5] = "6" $avArray[6] = "7" $avArray[7] = "8" $avArray[8] = "9" $avArray[9] = "10" Global $test = 0 For $i = 0 to UBound(iRows)-1 For $k = 1 to $iRows[$i] Func start() EndFunc If $test <> 0 Then Exitloop 2 Next Next Func start() $Runner = Not $Runner While $Runner MouseClick("left",1176, 817,1) Sleep(1000) MouseClick("left",384,817,1) Sleep(1000) MouseClick("left",1397,980,1) Sleep(3000) WEnd EndFunc ;==>start the error is >"C:Program Files (x86)AutoIt3SciTE..autoit3.exe" /ErrorStdOut "C:UsersChronosDocumentsAutoitsdfgdfg.au3" "C:UsersChronosDocumentsAutoitsdfgdfg.au3" (20) : ==> "For" statement has no matching "Next" statement.: Link to comment Share on other sites More sharing options...
Palestinian Posted April 6, 2014 Share Posted April 6, 2014 (edited) malkerian please use the code tags when posting codes, it makes your post more organized and easier for everyone else to read/help you with it. expandcollapse popup#include <Array.au3> Local $avArray[10] Local $iRows = UBound($aArray, 1) ; Total number of rows. In this example it will be 10. $avArray[0] = "1" $avArray[1] = "2" $avArray[2] = "3" $avArray[3] = "4" $avArray[4] = "5" $avArray[5] = "6" $avArray[6] = "7" $avArray[7] = "8" $avArray[8] = "9" $avArray[9] = "10" Global $test = 0 For $i = 0 to UBound(iRows)-1 For $k = 1 to $iRows[$i] Func start() EndFunc If $test <> 0 Then Exitloop 2 Next Next Func start() $Runner = Not $Runner While $Runner MouseClick("left",1176, 817,1) Sleep(1000) MouseClick("left",384,817,1) Sleep(1000) MouseClick("left",1397,980,1) Sleep(3000) WEnd EndFunc ;==>start Edited April 6, 2014 by Palestinian Link to comment Share on other sites More sharing options...
mikell Posted April 6, 2014 Share Posted April 6, 2014 Added some comments #include <Array.au3> Local $avArray[10] $avArray[0] = "1" $avArray[1] = "2" $avArray[2] = "3" $avArray[3] = "4" $avArray[4] = "5" $avArray[5] = "6" $avArray[6] = "7" $avArray[7] = "8" $avArray[8] = "9" $avArray[9] = "10" Global $test = 0 ; initialize the switch (OFF) For $i = 0 to UBound($avArray)-1 ; loops from index 0 to index 9 of $avArray For $k = 1 to $avArray[$i] ; loops from value 1 to the value inside $avArray[$i] Func start() If $test <> 0 Then Exitloop 2 ; If the switch is ON then exit Next Next Func start() ; .... ; In this func you have to use a condition to manage the switch $test EndFunc ;==>start 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