Jump to content
Sign in to follow this  
Best4FREE

Why not names it random please help screenshot name random 001 002 003

Recommended Posts

Best4FREE

#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

Share this post


Link to post
Share on other sites
BigDod

#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

You are setting $number back to 1 at the start of your function.


Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

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

Share this post


Link to post
Share on other sites
Jos

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 by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     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
Best4FREE

WOrking ?

Share this post


Link to post
Share on other sites
Jos

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 by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     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
GEOSoft

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 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!"

Share this post


Link to post
Share on other sites
everseeker

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

Share this post


Link to post
Share on other sites
weaponx

For $X = 0 to 100
    ConsoleWrite(StringFormat("%03i", $X) & @CRLF);000, 001, 002....100
Next

Share this post


Link to post
Share on other sites
GEOSoft

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

:party:

Edited 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!"

Share this post


Link to post
Share on other sites
Jos

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 Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
GEOSoft

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!"

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  

×