Help in setting task and variables

Discuss RoboTask here
Post Reply
dhirens
Posts: 3
Joined: Mon Dec 20, 2004 12:32 am
Location: India

Help in setting task and variables

Post by dhirens »

I am unable to set variable and need help in setting new variables. Kindly consider the task first.
PC will generate new files as under.
M2012Q.245
M2112Q.246 and so on.
Where in first two letters after M denote day and next 2 digits after day is month. EXT is settlement number for particular day.
Extract file EXT is not working for me. If I have to define this extention, say 245 as 3 digit number which may occur in name also in another case, how do I set this variable ?
I wish to rename this file as MARGIN {DAY} {MONTHNO} {YEAR}.{SETT NO}.TXT
Since I am unable to set variable for 3 digit number, I cant set this simple rename process.
Kindly include examples on setting up variables in help files and website so that user can define rules easily.
Awaiting your prompt reply.
 
 
 
Oleg
Site Admin
Posts: 3209
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Help in setting task and variables

Post by Oleg »

Extract file EXT is not working for me. If I have to define this extention, say 245 as 3 digit number which may occur in name also in another case, how do I set this variable ?
Why not working? I tried to show a message {ExtractFileExt(M2012Q.245)} and it works fine. RoboTask shows me a message "245". If you want to assign this value to variable use Set Variable action and don't forget turn On Expand Variable Value checkbox.
Kindly include examples on setting up variables in help files and website so that user can define rules easily.
There are the following actions for this purpose:
- Create Variable;
- Set Variable;
- Remove Variable;
- Increment Variable for increment (or decrement) a numeric value.

These actions very simple for understanding and using.
dhirens
Posts: 3
Joined: Mon Dec 20, 2004 12:32 am
Location: India

Help in setting task and variables

Post by dhirens »

Dear Oleg,
I appreciate your prompt reply. Thanks for the same.
In above case, as explained by you works as you input file name as M2012Q.245. But when file name and extention is not known, ie. when it changes, some variable has to set.
To pick up this file for rename, I am trying to set it as M{DAY}{MONTHNO}Q.XXX. Now XXX will not work. ROBOTASK does not identify ??? or *. Hence I wanted to set a variable which is nothing but a 3 digit number so that I can ask robotask to select a file which is made today by PC and move it to folder which is a settlment number for that particular day.
Please note that in above case, settlement number is different everyday. 245, 246, 247 and so on till 350.
Therefore please guide me on set up of variable which is a 3 digit number and can be anything from 0 to 350.
Since M{DAY}{MONTHNO}Q.??? or M{DAY}{MONTHNO}Q.* is not working for extract of file extention, I guess that set up of variable could be the only solution.
Once again I appreciate your efforts in helping users. Awaiting solution.
 
 
 
 
 
Oleg
Site Admin
Posts: 3209
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Help in setting task and variables

Post by Oleg »

Let's make more exact the problem definition.
I understood your problem so:
- select files in specified folder by mask.
- mask is M{DAY}{MONTHNO}Q.* where extension is three numbers
- you want to move each file to folder named as extension of file (or folder name is based on extension of file).

I think that you should use a File Loop to select the files by mask. Each file name you can assign to variable. Next you can extract the extension from each file and move it anywhere.
See task below. This task enumerates all files in folder d:\source by mask M{DAY}{MONTHNO}Q.*, extracts the file extension from each file and assign it to variable.
You can save text of the task in any file and use menu Task | Import to import it into RoboTask.

;**********************
;* RoboTask Task file *
;* Do not edit!       *
;**********************

[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|565106205
ContinueOnError=INTEGER|0
ExternalName=STRING|"Task211"
Hide=INTEGER|0
ID=INTEGER|2123454188
Name=STRING|"Settlment"
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3

[Actions]
Action1=FOLDER
Action2=FOLDER
Action3=FOLDER
Action4=FOLDER
Action5=FOLDER
Action6=FOLDER
Action7=FOLDER
Action8=FOLDER

[Actions\Action1]
ActionID=STRING|"A_LOOP_FILE"
Enabled=INTEGER|-1
Name=STRING|"File Loop"
Params=FOLDER

[Actions\Action1\Params]
createmode=STRING|"1"
date1=STRING|"20041221"
date2=STRING|"20041221"
destvar=STRING|"F_NAME"
DuringDays=STRING|"1"
DuringMonths=STRING|"1"
file0=STRING|"D:\source\M{DAY}{MONTHNO}Q.*"
filecount=STRING|"1"
OlderDays=STRING|"1"
OlderMonths=STRING|"1"
savesize=STRING|"0"
subdirs=STRING|"1"
timesize=STRING|"0"
WithoutPath=STRING|"0"

[Actions\Action2]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""F_NAME1"" with value ""{ExtractFileName({f_name})}"""
Params=FOLDER

[Actions\Action2\Params]
expand=STRING|"1"
varname=STRING|"F_NAME1"
varvalue=STRING|"{ExtractFileName({f_name})}"

[Actions\Action3]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""F_EXT"" with value ""{ExtractFileExt({f_name})}"""
Params=FOLDER

[Actions\Action3\Params]
expand=STRING|"1"
varname=STRING|"F_EXT"
varvalue=STRING|"{ExtractFileExt({f_name})}"

[Actions\Action4]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show ""File name: {f_name}"""
Params=FOLDER

[Actions\Action4\Params]
icon=STRING|"1"
msg0=STRING|"File name: {f_name}"
msg1=STRING|"File name without path: {f_name1}"
msg2=STRING|"File extension: {f_ext}"
msgcount=STRING|"3"
playsound=STRING|"0"
showmessage=STRING|"1"

[Actions\Action5]
ActionID=STRING|"A_LOOP_END"
Enabled=INTEGER|-1
Name=STRING|"End Loop"

[Actions\Action6]
ActionID=STRING|"A_VARIABLES_REMOVE"
Enabled=INTEGER|-1
Name=STRING|"Remove variable ""F_NAME"""
Params=FOLDER

[Actions\Action6\Params]
varname=STRING|"F_NAME"

[Actions\Action7]
ActionID=STRING|"A_VARIABLES_REMOVE"
Enabled=INTEGER|-1
Name=STRING|"Remove variable ""F_NAME1"""
Params=FOLDER

[Actions\Action7\Params]
varname=STRING|"F_NAME1"

[Actions\Action8]
ActionID=STRING|"A_VARIABLES_REMOVE"
Enabled=INTEGER|-1
Name=STRING|"Remove variable ""F_EXT"""
Params=FOLDER

[Actions\Action8\Params]
varname=STRING|"F_EXT"

;end of task
dhirens
Posts: 3
Joined: Mon Dec 20, 2004 12:32 am
Location: India

Help in setting task and variables

Post by dhirens »

Dear Oleg,
thanks for the solution. It worked now. I also got an idea on setting up variables.
Thanks a lot once again.
Post Reply