Screenshot filename increment

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
Zjaii
Newbie
Posts: 11
Joined: Fri Oct 15, 2010 3:48 pm

Screenshot filename increment

Post by Zjaii » Fri Oct 15, 2010 4:29 pm

I was looking for a way to establish a counter that increments per screenshot taken. Getdate and Gettime utilize characters that arent usable in filenames.
A couple of other posts offered a work around, but I dont think its the best workaround. Suggestions for improvement to help me and any others would be appreciated.

Code:

OnEvent>KEY_DOWN,VK192,0,Screenshot
Label>Idle_Loop
Wait>0.02
Goto>Idle_Loop

SRT>Screenshot

Year>Y
Month>M
Day>D
Hour>H
Sec>S

Let>Stamp=%Y%_%M%_%D%_%H%_%S%

GetScreenRes>screen_x,screen_y
ScreenCapture>0,0,screen_x,screen_y,C:\Documents and Settings\Z\My Documents\My Pictures\Screenshot_%Stamp%.bmp

PlayWav>chimes.wav

End>Screenshot

adroege
Automation Wizard
Posts: 438
Joined: Tue Dec 07, 2004 7:39 pm

Post by adroege » Fri Oct 15, 2010 5:44 pm

You could do something like this:

Code: Select all

IfFileExists>c:\screenshot_counter.ini
   ReadIniFile>c:\screenshot_counter.ini,ScreenShot,Counter,strValue
   Add>strValue,1
   EditIniFile>c:\screenshot_counter.ini,ScreenShot,Counter,strValue
   MessageModal>counter=%strValue%
Else
   MessageModal>c:\screenshot_counter.ini file is missing!
   //Optional -- create the file
   WriteLn>c:\screenshot_counter.ini,IO_result,[ScreenShot]
   WriteLn>c:\screenshot_counter.ini,IO_result,Counter=1
Endif

However I like the date/time stamp just as well.

???? why aren't you using
Min>Min
to get the minutes???

Zjaii
Newbie
Posts: 11
Joined: Fri Oct 15, 2010 3:48 pm

Screenshot Tool for MS Image Recognition

Post by Zjaii » Mon Oct 25, 2010 3:19 am

Brilliant! Lets have a Guinness. Umm, I guess I threw it together and overlooked including minutes, I shall have to add even though its an awefully long filename I think its most usefull to try to include all the info.

Code: Select all

//Number Pad 0 should fire out some usefull screenshots for the best comparisons and planning during image recognition.
OnEvent>KEY_DOWN,VK96,0,Playmatic
Label>Idle_Loop
Wait>0.02
Goto>Idle_Loop

SRT>Playmatic

Year>Y
Month>Mo
Day>D
Hour>H
Min>Mi
Sec>S

Let>Stamp=%Y%_%Mo%_%D%_%H%_%Mi%_%S%

GetScreenRes>screen_x,screen_y
ScreenCapture>0,0,screen_x,screen_y,C:\Documents and Settings\Z\My Documents\My Pictures\Screenshot_%Stamp%.bmp

PlayWav>chimes.wav

End>Playmatic


Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts