How to determine the length of a filename

Discuss RoboTask here
Post Reply
thegmanagain
Posts: 3
Joined: Thu Dec 01, 2011 1:08 pm

How to determine the length of a filename

Post by thegmanagain »

Hi,
How do I determine the length of a filename and act on it accordingly.
Thanks,
Gavan
Oleg
Site Admin
Posts: 3202
Joined: Thu Jan 01, 1970 1:00 am
Contact:

How to determine the length of a filename

Post by Oleg »

There is {StrLength()} system variable
you can use it such:
{StrLength(Some string)}
{StrLength({filename})}

also see small example below:

;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************

[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|827538953
Comment=STRINGLIST
ContinueOnError=INTEGER|0
ExternalName=STRING|"Task1118"
Hide=INTEGER|0
ID=INTEGER|2146977976
LocalVariables=STRING|"filename"
LogOnAsUser=INTEGER|1
Name=STRING|"length of filename"
OnErrorTaskID=INTEGER|0
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3
WriteGeneralLog=INTEGER|0

[Actions]
Action1=FOLDER
Action2=FOLDER
Action3=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|"20111208"
date2=STRING|"20111208"
destvar=STRING|"FILENAME"
DuringDays=STRING|"1"
DuringHours=STRING|"1"
DuringMinutes=STRING|"1"
DuringMonths=STRING|"1"
file0=STRING|"C:\incoming\*.txt"
filecount=STRING|"1"
OlderDays=STRING|"1"
OlderHours=STRING|"1"
OlderMinutes=STRING|"1"
OlderMonths=STRING|"1"
savesize=STRING|"0"
searchkind=STRING|"0"
subdirs=STRING|"0"
timesize=STRING|"0"
WithoutPath=STRING|"1"

[Actions\Action2]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show ""{filename}"""
Params=FOLDER

[Actions\Action2\Params]
icon=STRING|"1"
msg0=STRING|"{filename}"
msg1=STRING|"length of name {StrLength({filename})}"
msgcount=STRING|"2"
playsound=STRING|"0"
showmessage=STRING|"1"

[Actions\Action3]
ActionID=STRING|"A_LOOP_END"
Enabled=INTEGER|-1
Name=STRING|"End Loop"
thegmanagain
Posts: 3
Joined: Thu Dec 01, 2011 1:08 pm

How to determine the length of a filename

Post by thegmanagain »

Thanks Oleg
Post Reply