Page 1 of 1

put a variable in file name

Posted: Fri Nov 20, 2015 10:48 am
by nikameto
my process repeats itself every 2 hours and takes screens, so when i leave my computer on at night, when a screen is made, it overwrites itself, so i have come up with idea of putting a variable for example "count" and when the proccess finishes to increment it by 1 and file name will be screen{counter} and i will have screen 1 screen 2 , screen 3 screen 4 etc,

Re: put a variable in file name

Posted: Sat Nov 21, 2015 8:03 am
by Oleg
You have to create global variable Counter with value 1
menu Options->Variables
GlobalVar.png
GlobalVar.png (28.35 KiB) Viewed 25977 times
Also see my example:

Code: Select all

;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
 
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|1416408852
Comment=STRINGLIST
ContinueOnError=INTEGER|0
ExternalName=STRING|"Task59"
Hide=INTEGER|0
ID=INTEGER|529022353
LogOnAsUser=INTEGER|1
Name=STRING|"put variable into the filename"
OnErrorTaskID=INTEGER|-1
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3
WriteGeneralLog=INTEGER|0

[Actions]
Action1=FOLDER
Action2=FOLDER

[Actions\Action1]
ActionID=STRING|"A_SCR_SCREEN"
Enabled=INTEGER|-1
Name=STRING|"Screenshot"
Params=FOLDER

[Actions\Action1\Params]
captureregion=STRING|"0"
filename=STRING|"c:\temp\screen{Counter}.jpg"
format=STRING|"1"

[Actions\Action2]
ActionID=STRING|"A_VARIABLES_INCREMENT"
Enabled=INTEGER|-1
Name=STRING|"Increment variable ""Counter"""
Params=FOLDER

[Actions\Action2\Params]
incement=STRING|"1"
vaiable=STRING|"Counter"
Save the text of the task to a file and use menu Task->Import to import the task into RoboTask.

This task creates screenshots with number screen1.jpg, screen2.jpg and so on.
Screenshots are in c:\temp folder.

Re: put a variable in file name

Posted: Mon Nov 23, 2015 11:55 am
by Oleg
Also I recommend you to use screen name with current date-time like this
screen-{DateTimeToFormat({DateTime},yyyy-mm-dd-hh-nn-ss)}.jpg

This expression generetes name like this:
screen-2015-11-23-12-53-36.jpg

The names always be unique and contain the date and time when they has been saved.
In this case you do not need to use any counters.

Re: put a variable in file name

Posted: Sun Nov 29, 2015 7:57 pm
by nikameto
Oh my god this is super awesome. ROBOTASK IS THE FUTURE. :D :)
Thank you very much.