Oleg the star

Discuss RoboTask here
Post Reply
deesloop
Posts: 70
Joined: Wed Feb 25, 2009 3:44 am

Oleg the star

Post by deesloop »

You are so quick to respond to issues and I'd like to thank you for that. So here is another (simple) problem for you.

A folder has files init as follows

Date_1234.pdf
Date_1235.pdf
Date_1236.pdf
Date_1238.pdf
Date_1250.pdf

So I want to generate a list of all the files in the folder and truncate the result and email it. So the user gets the following

The following files were updated, please check them out.
1234
1235
1236
1238
1250

I can I believe assign the contents to a variable and email that, but it's the manipulating of the variable I neeed.

Thanks once again for your time and effort :)
deesloop
Posts: 70
Joined: Wed Feb 25, 2009 3:44 am

Oleg the star

Post by deesloop »

Subfolders is not required.
I just want to truncate the names of the files and dont need the file patch or suchlike either.
deesloop
Posts: 70
Joined: Wed Feb 25, 2009 3:44 am

Oleg the star

Post by deesloop »

Woohoo
Sorted this myself
The variable {} are throwing me

The variable is referred to without brackets
The variables values is referred to with brackets

Doh!
Oleg
Site Admin
Posts: 3105
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Oleg the star

Post by Oleg »

can I believe assign the contents to a variable and email that, but it's the manipulating of the variable I neeed.
See the example below. You can use variable NewList in the message body.

Code: Select all

;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
 
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|2099193306
Comment=STRINGLIST
ContinueOnError=INTEGER|0
ExternalName=STRING|"Task210"
Hide=INTEGER|0
ID=INTEGER|5850235
LogOnAsUser=INTEGER|1
Name=STRING|"Truncate names"
OnErrorTaskID=INTEGER|0
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3
WriteGeneralLog=INTEGER|0

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

[Actions\Action1]
ActionID=STRING|"A_VARIABLES_CREATE"
Enabled=INTEGER|-1
Name=STRING|"Create local variable ""LIST"" with value ""Date_1234.pdf {EOL}Date_1235.pdf {EOL}Date_1236.pd..."""
Params=FOLDER

[Actions\Action1\Params]
expand=STRING|"0"
varkind=STRING|"1"
varname=STRING|"LIST"
varvalue=STRING|"Date_1234.pdf {EOL}Date_1235.pdf {EOL}Date_1236.pdf {EOL}Date_1238.pdf {EOL}Date_1250.pdf"

[Actions\Action10]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show ""Result list:"""
Params=FOLDER

[Actions\Action10\Params]
icon=STRING|"1"
msg0=STRING|"Result list:"
msg1=STRING|"{NewList}"
msgcount=STRING|"2"
playsound=STRING|"0"
showmessage=STRING|"1"

[Actions\Action2]
ActionID=STRING|"A_VARIABLES_CREATE"
Enabled=INTEGER|-1
Name=STRING|"Create local variable ""C_FILE"" with value """""
Params=FOLDER

[Actions\Action2\Params]
expand=STRING|"0"
varkind=STRING|"1"
varname=STRING|"C_FILE"

[Actions\Action3]
ActionID=STRING|"A_VARIABLES_CREATE"
Enabled=INTEGER|-1
Name=STRING|"Create local variable ""NEWLIST"" with value """""
Params=FOLDER

[Actions\Action3\Params]
expand=STRING|"0"
varkind=STRING|"1"
varname=STRING|"NEWLIST"

[Actions\Action4]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show ""Initial list:"""
Params=FOLDER

[Actions\Action4\Params]
icon=STRING|"1"
msg0=STRING|"Initial list:"
msg1=STRING|"{list}"
msgcount=STRING|"2"
playsound=STRING|"0"
showmessage=STRING|"1"

[Actions\Action5]
ActionID=STRING|"A_LOOP_TEXT"
Enabled=INTEGER|-1
Name=STRING|"Text Loop"
Params=FOLDER

[Actions\Action5\Params]
destvar=STRING|"C_FILE"
line0=STRING|"{list}"
linecount=STRING|"1"
sourcetext=STRING|"1"

[Actions\Action6]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""C_FILE"" with value ""{ExtractFileNameNoExt({c_file})}"""
Params=FOLDER

[Actions\Action6\Params]
expand=STRING|"1"
varname=STRING|"C_FILE"
varvalue=STRING|"{ExtractFileNameNoExt({c_file})}"

[Actions\Action7]
ActionID=STRING|"A_STR_DELETE"
Enabled=INTEGER|-1
Name=STRING|"STR Delete"
Params=FOLDER

[Actions\Action7\Params]
amount=STRING|"5"
from=STRING|"1"
source=STRING|"{c_file}"
variable=STRING|"c_file"

[Actions\Action8]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""NEWLIST"" with value ""{NewList}{c_file}{eol}"""
Params=FOLDER

[Actions\Action8\Params]
expand=STRING|"1"
varname=STRING|"NEWLIST"
varvalue=STRING|"{NewList}{c_file}{eol}"

[Actions\Action9]
ActionID=STRING|"A_LOOP_END"
Enabled=INTEGER|-1
Name=STRING|"End Loop"
Oleg
Site Admin
Posts: 3105
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Oleg the star

Post by Oleg »

The variable is referred to without brackets
The variables values is referred to with brackets
Variable name is only the set of chars without braces {}
You have to use braces in other expressions because you should tell RoboTask that expression in braces contains the variable name and RoboTask must calculate the value.
Any strings or words outside of braces will be uses as simple strings as is.

For example:
the expression Today is {date} will be transformed into Today is 12/12/2012
but the expression Today is date will remain the same without changes
Last edited by Oleg on Wed Dec 12, 2012 6:13 pm, edited 1 time in total.
Post Reply