Jump to content
Sign in to follow this  
foolove

incrementing a variable by 1 for each instance

Recommended Posts

foolove

Instead of having 1,2,3,4,5,6,7,8 for the images how can i assign a variable and have it increment by count 1 each time the variable is called i want to have a while loop with this

Also additionally would like to have the loop exit on say like when count is up to 144 or after it has been call so many times issue ExitLoop

#include <ScreenCapture.au3>
 
;Set the scrip to exit when you press ESC
HotKeySet("{ESC}", "Terminate")
 
Func Terminate()
    Exit 0
EndFunc
 
 
sleep(5000)
 
For $i = 1 to 144 Step 1
MouseMove(76,125,3)
sleep(5000)
_ScreenCapture_Capture(@MyDocumentsDir & "\DDH_$i.jpg", 1030, 61, 1267, 397)
sleep(500)
 
MouseMove(185,125,3)
sleep(500)
_ScreenCapture_Capture(@MyDocumentsDir & "\DDH_$i.jpg", 1030, 61, 1267, 397)
sleep(500)
 
MouseMove(298,125,3)
sleep(500)
_ScreenCapture_Capture(@MyDocumentsDir & "\DDH_$i.jpg", 1030, 61, 1267, 397)
sleep(500)
 
MouseMove(423,125,3)
sleep(500)
_ScreenCapture_Capture(@MyDocumentsDir & "\DDH_$i.jpg", 1030, 61, 1267, 397)
sleep(500)
 
MouseMove(541,125,3)
sleep(500)
_ScreenCapture_Capture(@MyDocumentsDir & "\DDH_$i.jpg", 1030, 61, 1267, 397)
sleep(500)
 
MouseMove(661,125,3)
sleep(500)
_ScreenCapture_Capture(@MyDocumentsDir & "\DDH_$i.jpg", 1030, 61, 1267, 397)
sleep(500)
 
MouseMove(779,125,3)
sleep(500)
_ScreenCapture_Capture(@MyDocumentsDir & "\DDH_$i.jpg", 1030, 61, 1267, 397)
sleep(500)
 
MouseMove(899,125,3)
sleep(500)
_ScreenCapture_Capture(@MyDocumentsDir & "\DDH_$i.jpg", 1030, 61, 1267, 397)
sleep(500)
 
MouseWheel ( "down" )
sleep(500)
Next
Edited by foolove

Share this post


Link to post
Share on other sites
foolove

jos thanks for steering me in the right direction my edits are about script saves files everytime with $i

Share this post


Link to post
Share on other sites
Ramzes

You can use

For $i = 1 to 144
;code
Next

without 'Step 1'

To concatenating two strings you should use '&', i. e.:

@MyDocumentsDir & "\DDH_" & $i & ".jpg"

You can also create an array of mouse and screen positions to make your script simpler.

I recommend AutoIt Documentation.


Sorry for my bad English but nobody is perfect. [font=arial, helvetica, sans-serif]Ramzes[/font]

Share this post


Link to post
Share on other sites
foolove

ramzes you are an autoit god thanks now i know how to accomplish those two things if it arises in the future i will know!!

Share this post


Link to post
Share on other sites
somdcomputerguy

Ramzes beat me to it with the same idea. I use code like this in one of my scripts. I have 10 images, hourglass1.ico -> hourglass10.ico.

For $i = 1 to 10
  TraySetIcon("hourglass" & $i & ".ico")
  Sleep(125)
Next

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites
foolove

guys do thanks for the insight the script i have has only captured the screen for 3 images on a run through it i put the for loop at the begging and the next at the very end it does go through the mouse movements

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×