put a variable in file name
put a variable in file name
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
You have to create global variable Counter with value 1
menu Options->Variables Also see my example:
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.
menu Options->Variables 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"
This task creates screenshots with number screen1.jpg, screen2.jpg and so on.
Screenshots are in c:\temp folder.
Oleg Yershov
Re: put a variable in file name
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.
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.
Oleg Yershov
Re: put a variable in file name
Oh my god this is super awesome. ROBOTASK IS THE FUTURE.

Thank you very much.


Thank you very much.