Best4FREE Posted March 26, 2008 Posted March 26, 2008 #include <Misc.au3> #include <ScreenCapture.au3> HotKeySet("{ESC}", "Terminate") HotKeySet ("{F1}","Screencaputure" ) Func Terminate() Exit 0 EndFunc Func Screencaputure() Local $number = 1 Local $capture = _ScreenCapture_Capture("", 240, 355, 429, 406, False) Local $save = _ScreenCapture_SaveImage(@scriptDir & "\Screenshots\Screenshot " & $number & ".bmp", $capture) $number = $number + 1 EndFunc while 1 sleep (1000) WEnd why it overwrite the old screenshot i wanna that it name screenshot like 001 002 003
BigDod Posted March 26, 2008 Posted March 26, 2008 #include <Misc.au3>#include <ScreenCapture.au3>HotKeySet("{ESC}", "Terminate")HotKeySet ("{F1}","Screencaputure" )Func Terminate() Exit 0EndFuncFunc Screencaputure() Local $number = 1 Local $capture = _ScreenCapture_Capture("", 240, 355, 429, 406, False) Local $save = _ScreenCapture_SaveImage(@scriptDir & "\Screenshots\Screenshot " & $number & ".bmp", $capture) $number = $number + 1 EndFuncwhile 1 sleep (1000)WEnd why it overwrite the old screenshot i wanna that it name screenshot like 001 002 003You are setting $number back to 1 at the start of your function. Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother
Developers Jos Posted March 26, 2008 Developers Posted March 26, 2008 (edited) What do you think this line does ? Local $number = 1 You need to make it a Global variable to be able to add 1 to it each time... something like: #include <Misc.au3> #include <ScreenCapture.au3> Global $number = 1 HotKeySet("{ESC}", "Terminate") HotKeySet("{F1}", "Screencaputure") While 1 Sleep(1000) WEnd ; Func Terminate() Exit 0 EndFunc ;==>Terminate ; Func Screencaputure() Local $capture = _ScreenCapture_Capture("", 240, 355, 429, 406, False) Local $save = _ScreenCapture_SaveImage(@ScriptDir & "\Screenshots\Screenshot " & $number & ".bmp", $capture) $number = $number + 1 EndFunc ;==>Screencaputure Edited March 26, 2008 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
Developers Jos Posted March 26, 2008 Developers Posted March 26, 2008 (edited) WOrking ?No, my work is done for the day ... its evening here. ..but if you mean: Is the script worling then I tell you I don't know... just wanted to show you where to define the variable , thats all.You are supposed to do the rest of the work yourself.Jos Edited March 26, 2008 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
GEOSoft Posted March 26, 2008 Posted March 26, 2008 (edited) something else that hasn't been mentioned yet. If you want 001, 002, 003 etc the you also have to add some code to pad $number with leading 0s. If StringLen($number) < 3 Then Do $number = "0" & $number Until StringLen($number) = 3 EndIf Edited March 26, 2008 by GEOSoft George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!"
Developers Jos Posted March 26, 2008 Developers Posted March 26, 2008 I know you are going to curse me for this but this is what I normally use: StringRight("000"& $number,3) SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
everseeker Posted March 26, 2008 Posted March 26, 2008 I know you are going to curse me for this but this is what I normally use: StringRight("000"& $number,3) I like that..... Going to file that nugget away!!!!! Everseeker
weaponx Posted March 26, 2008 Posted March 26, 2008 For $X = 0 to 100 ConsoleWrite(StringFormat("%03i", $X) & @CRLF);000, 001, 002....100 Next
GEOSoft Posted March 26, 2008 Posted March 26, 2008 (edited) I know you are going to curse me for this but this is what I normally use: StringRight("000"& $number,3)I won't curse you for posting that. I'll just grumble about it for a couple of hour. That's really nice, efficient code. Mine looks like it's actually doing something. Edit: Besides I thing you gave an incomplete statement. $number = StringRight("000" & $number, 3) ;;name the file in here and then $number +=1 Edited March 26, 2008 by GEOSoft George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!"
Developers Jos Posted March 26, 2008 Developers Posted March 26, 2008 Edit: Besides I thing you gave an incomplete statement. $number = StringRight("000" & $number, 3) ;;name the file in here and then $number +=1 Nah.. I would: Local $save = _ScreenCapture_SaveImage(@ScriptDir & "\Screenshots\Screenshot " & StringRight("000" & $number, 3) & ".bmp", $capture) $number +=1 SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
GEOSoft Posted March 26, 2008 Posted March 26, 2008 Nah.. I would: Local $save = _ScreenCapture_SaveImage(@ScriptDir & "\Screenshots\Screenshot " & StringRight("000" & $number, 3) & ".bmp", $capture) $number +=1 OK Ninja coder, you made your point and I lose again. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!"
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