Jump to content

incrementing a variable by 1 for each instance


Recommended Posts

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
Link to comment
Share on other sites

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]

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...