Jump to content
Sign in to follow this  
foolove

problems getting screen captures

Recommended Posts

foolove

If i have my code as 1 to 144 as images DDH_1.jpg DDH_2.jpg the screen captures go as planned below for whatever reason I may only grab one capture out of 144 not sure whats going wrong also how would i put MouseMove() calls in an array to make my code even shorter it would be nice to figure this out bc sometimes i have to do 1000 screen shots and then i have to go into code and do a ton of copy and paste

#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
 
MouseMove(76,125,3)
sleep(1000)
_ScreenCapture_Capture(@MyDocumentsDir & "DDH_" & $i & ".jpg", 1030, 61, 1267, 397)
sleep(1000)
 
MouseMove(185,125,3)
sleep(1000)
_ScreenCapture_Capture(@MyDocumentsDir & "DDH_" & $i & ".jpg", 1030, 61, 1267, 397)
sleep(1000)
 
MouseMove(298,125,3)
sleep(1000)
_ScreenCapture_Capture(@MyDocumentsDir & "DDH_" & $i & ".jpg", 1030, 61, 1267, 397)
sleep(1000)
 
MouseMove(423,125,3)
sleep(1000)
_ScreenCapture_Capture(@MyDocumentsDir & "DDH_" & $i & ".jpg", 1030, 61, 1267, 397)
sleep(1000)
 
MouseMove(541,125,3)
sleep(1000)
_ScreenCapture_Capture(@MyDocumentsDir & "DDH_" & $i & ".jpg", 1030, 61, 1267, 397)
sleep(1000)
 
MouseMove(661,125,3)
sleep(1000)
_ScreenCapture_Capture(@MyDocumentsDir & "DDH_" & $i & ".jpg", 1030, 61, 1267, 397)
sleep(1000)
 
MouseMove(779,125,3)
sleep(1000)
_ScreenCapture_Capture(@MyDocumentsDir & "DDH_" & $i & ".jpg", 1030, 61, 1267, 397)
sleep(1000)
 
MouseMove(899,125,3)
sleep(1000)
_ScreenCapture_Capture(@MyDocumentsDir & "DDH_" & $i & ".jpg", 1030, 61, 1267, 397)
sleep(1000)
 
MouseWheel ( "down" )
sleep(1000)
 
Next
Edited by foolove

Share this post


Link to post
Share on other sites
foolove

im working on the array now will upload new code in a sec not sure why the screen captures are not going as planned i really need to do my code like the above though

Share this post


Link to post
Share on other sites
foolove

below is my failing attempt at implementing an array not sure what im doing wrong?

#include <ScreenCapture.au3>
#include <Array.au3>

Local $avArray[8]

$avArray[0] = "MouseMove(76,125,3)"
$avArray[1] = "MouseMove(185,125,3)"
$avArray[2] = "MouseMove(298,125,3)"
$avArray[3] = "MouseMove(423,125,3)"
$avArray[4] = "MouseMove(541,125,3)"
$avArray[5] = "MouseMove(661,125,3)"
$avArray[6] = "MouseMove(779,125,3)"
$avArray[7] = "MouseMove(899,125,3)"


;Set the scrip to exit when you press ESC
HotKeySet("{ESC}", "Terminate")

Func Terminate()
    Exit 0
EndFunc


sleep(5000)

$set = "CMD"

For $i = 1 to 616

_ArrayAdd($avArray, "MouseMove(76,125,3)", "MouseMove(185,125,3)", "MouseMove(298,125,3)", "MouseMove(423,125,3)", "MouseMove(541,125,3)", "MouseMove(661,125,3)", "MouseMove(779,125,3)", "MouseMove(899,125,3)")
sleep(1000)
_ScreenCapture_Capture(@MyDocumentsDir & "\images\" & $set & "\" & $set & "_" & $i & ".jpg", 1030, 61, 1267, 397)
sleep(1000)

MouseWheel ( "down" )
sleep(1000)

Next

Share this post


Link to post
Share on other sites
JohnOne

I see you have started to think about trying something yourself. That's a step in the right direction.

Am I correct in thinking that you want to repeat this section of code 144 with different mouse coordinates?

MouseMove(76,125,3)
sleep(1000)
_ScreenCapture_Capture(@MyDocumentsDir & "DDH_" & $i & ".jpg", 1030, 61, 1267, 397)
sleep(1000)

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites
foolove

yes different MouseMove there are 8 total but the 1030, 61, 1267, 397 will likely always be the same

Share this post


Link to post
Share on other sites
JohnOne

Then this might be a basic structure of code you could modify.

#include <ScreenCapture.au3>
 
;Set the scrip to exit when you press ESC
HotKeySet("{ESC}", "Terminate")
Func Terminate()
Exit 0
EndFunc   ;==>Terminate
 
Global $mouse[6] = [76, 185, 298, 423, 541, 661] ; this is an array with your x mouse coords
 
Sleep(5000)
 
For $i = 0 To 5 ; all 6 elements of array
MouseMove($mouse[$i], 125, 3)
Sleep(1000)
_ScreenCapture_Capture(@MyDocumentsDir & "DDH_" & $i & ".jpg", 1030, 61, 1267, 397)
Sleep(1000)
Next

This holds just 6, for more you would just need to get them into an array, via many different possible avenues including fileread() - stringsplit() combined amongst others.


AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites
foolove

very much thanks im moving in the right direction i think my problem now is im getting the same screen shot over and over not sure how to work witih my for loops on this

#include <ScreenCapture.au3>
#include <Array.au3>

;Set the scrip to exit when you press ESC
HotKeySet("{ESC}", "Terminate")
Func Terminate()
    Exit 0
EndFunc

Global $mouse[8] = [76, 185, 298, 423, 541, 661, 779, 899] ; this is an array with your x mouse coords

sleep(5000)

$set = "CMD"


For $i = 0 To 7 ; all 8 elements of array
For $d = 1 to 616
MouseMove($mouse[$i], 125, 3)
sleep(1000)
_ScreenCapture_Capture(@MyDocumentsDir & "\images\" & $set & "\" & $set & "_" & $d & ".jpg", 1030, 61, 1267, 397)
sleep(1000)
Next
MouseWheel ( "down" )
sleep(1000)
Next

Share this post


Link to post
Share on other sites
Jos

bumping post hoping someone can help :graduated:

Don't bump within 24 hours and be patient.

Maybe spent the time better to do some research yourself.


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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  

×