SQAGuy Posted December 1, 2010 Share Posted December 1, 2010 I am new to using loops and don't know which type would be best in this scenario... So far, I have generated an array of 200+ elements where each element contains the path to a file name.(presuming the application under test is running)1) Start Loop (For...Next, While...WEnd, Do...Until, For...In...Next ??? I'm not sure which one to use ???)2) Call function to invoke application's File|Open menu option. (I can do this)3) Extract element 1 from array and push into the Windows clipboard (??? I'm not sure how to do this ???)4) Paste array element 1 into the "Filename:" text field within the application's Open dialog. (I can do this)5) Select the Open dialog's [Open] button to open the file. (I can do this)6) Validate that the file opened without issue. (I can do this)7) Write Pass/Fail result to log file. (I can do this)8) Re-Invoke the application's Open File dialog (I can do this)9) Pull element 2 from array and repeat steps until reaching the last element in the array. (??? I'm not sure how to do this ???)Any and all help to steer me in the right direction would be greatly appreciated!Thanks. Link to comment Share on other sites More sharing options...
JohnOne Posted December 1, 2010 Share Posted December 1, 2010 You can use any loop you like, here are a couple of examples (untested) $i = 0 While $i <= Ubound($array) -1 ; 1. depends if your array is zero based ClipPut($array[$i]) ; 3. put contants into clipboard ;rest of code $i += 1 ; 9 will end loop when last element of array is reached WEnd For $i = 0 to UBound($array) -1 ClipPut($array[$i]) ;rest of code Next $i = 0 Do ClipPut($array[$i]) ;rest od code $i += 1 Until $i = UBound($array) -1 AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
SQAGuy Posted December 1, 2010 Author Share Posted December 1, 2010 Thanks so much for your help... I will try each example out! Link to comment Share on other sites More sharing options...
SparkSoft Posted December 2, 2010 Share Posted December 2, 2010 (edited) Are you tring to make a file syncing app or FTP app by any chance ? EDIT: Because i was trying to make something like the above and gave up Edited December 2, 2010 by SparkSoft [center]First Ever Script/App[/center][center]Simple Battery Meter[/center] Link to comment Share on other sites More sharing options...
SQAGuy Posted December 2, 2010 Author Share Posted December 2, 2010 You can use any loop you like, here are a couple of examples (untested) $i = 0 While $i <= Ubound($array) -1 ; 1. depends if your array is zero based ClipPut($array[$i]) ; 3. put contants into clipboard ;rest of code $i += 1 ; 9 will end loop when last element of array is reached WEnd For $i = 0 to UBound($array) -1 ClipPut($array[$i]) ;rest of code Next $i = 0 Do ClipPut($array[$i]) ;rest od code $i += 1 Until $i = UBound($array) -1 QUESTION: The loop gets stuck trying to pass element [0] in the array. What do I need to do for the loop to skip the [0] element in the array since [0] only contains the total # of elements not a path to a file, then proceed to go through element [1] through [n] ? Thanks for your help!! Link to comment Share on other sites More sharing options...
JohnOne Posted December 2, 2010 Share Posted December 2, 2010 start the loop at 1 $i = 1 or For $i = 1 To ... AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. 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