Page 1 of 1
can robotask save files with custom name?
Posted: Sat Dec 20, 2008 12:42 pm
by nick
I have 100 html files that I want to save with the word
between <h1> and </h1> as name.
ex.
1. I have 0001.html with inside <h1>robotask help</h1>
2. result: robotask-help.html
ex2
1. I have 0002.html with inside <h1>robotask</h1>
2. result: robotask.html
gr.
can robotask save files with custom name?
Posted: Tue Dec 23, 2008 11:39 pm
by Oleg
Of course you can do this.
See the example below. It finds *.HTML files in c:\incoming folder and renames them by your rule.
;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|1380072790
ContinueOnError=INTEGER|0
ExternalName=STRING|"Task744"
Hide=INTEGER|0
ID=INTEGER|615134226
LogOnAsUser=INTEGER|1
Name=STRING|"Rename HTM files"
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3
WriteGeneralLog=INTEGER|0
[Actions]
Action1=FOLDER
Action10=FOLDER
Action11=FOLDER
Action12=FOLDER
Action13=FOLDER
Action14=FOLDER
Action2=FOLDER
Action3=FOLDER
Action4=FOLDER
Action5=FOLDER
Action6=FOLDER
Action7=FOLDER
Action8=FOLDER
Action9=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|"20081222"
date2=STRING|"20081222"
destvar=STRING|"C_HTM"
DuringDays=STRING|"1"
DuringMonths=STRING|"1"
file0=STRING|"c:\incoming\*.html"
filecount=STRING|"1"
OlderDays=STRING|"1"
OlderMonths=STRING|"1"
savesize=STRING|"0"
searchkind=STRING|"0"
subdirs=STRING|"1"
timesize=STRING|"0"
WithoutPath=STRING|"0"
[Actions\Action10]
ActionID=STRING|"A_FILE_RENAME"
Enabled=INTEGER|-1
Name=STRING|"Rename File"
Params=FOLDER
[Actions\Action10\Params]
count=STRING|"1"
file0=STRING|"{c_htm}"
mask=STRING|"{newname}.*"
subdirs=STRING|"0"
[Actions\Action11]
ActionID=STRING|"A_LOOP_BREAK"
Enabled=INTEGER|-1
Name=STRING|"Break"
[Actions\Action12]
ActionID=STRING|"A_FLOW_ENDIF"
Enabled=INTEGER|-1
Name=STRING|"End If"
[Actions\Action13]
ActionID=STRING|"A_LOOP_END"
Enabled=INTEGER|-1
Name=STRING|"End Loop"
[Actions\Action14]
ActionID=STRING|"A_LOOP_END"
Enabled=INTEGER|-1
Name=STRING|"End Loop"
[Actions\Action2]
ActionID=STRING|"A_LOOP_TEXT"
Enabled=INTEGER|-1
Name=STRING|"Text Loop"
Params=FOLDER
[Actions\Action2\Params]
destvar=STRING|"C_LINE"
file=STRING|"{c_htm}"
linecount=STRING|"0"
sourcetext=STRING|"0"
[Actions\Action3]
ActionID=STRING|"A_STR_POS"
Enabled=INTEGER|-1
Name=STRING|"STR Pos"
Params=FOLDER
[Actions\Action3\Params]
from=STRING|"1"
search=STRING|"<h1>"
source=STRING|"{c_line}"
variable=STRING|"pos1"
[Actions\Action4]
ActionID=STRING|"A_FLOW_IF"
Enabled=INTEGER|-1
Name=STRING|"If Then"
Params=FOLDER
[Actions\Action4\Params]
case=STRING|"0"
operator=STRING|"3"
type=STRING|"1"
value1=STRING|"{pos1}"
value2=STRING|"0"
[Actions\Action5]
ActionID=STRING|"BASIC_EVALUATE"
Enabled=INTEGER|-1
Name=STRING|"Evaluate"
Params=FOLDER
[Actions\Action5\Params]
expression=STRING|"{pos1}+4"
variable=STRING|"POS1"
[Actions\Action6]
ActionID=STRING|"A_STR_POS"
Enabled=INTEGER|-1
Name=STRING|"STR Pos"
Params=FOLDER
[Actions\Action6\Params]
from=STRING|"1"
search=STRING|"</h1>"
source=STRING|"{c_line}"
variable=STRING|"pos2"
[Actions\Action7]
ActionID=STRING|"BASIC_EVALUATE"
Enabled=INTEGER|-1
Name=STRING|"Evaluate"
Params=FOLDER
[Actions\Action7\Params]
expression=STRING|"{pos2}-{pos1}"
variable=STRING|"LEN"
[Actions\Action8]
ActionID=STRING|"A_STR_EXTRACT"
Enabled=INTEGER|-1
Name=STRING|"STR Extract"
Params=FOLDER
[Actions\Action8\Params]
amount=STRING|"{len}"
from=STRING|"{pos1}"
source=STRING|"{c_line}"
variable=STRING|"newname"
[Actions\Action9]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|0
Name=STRING|"Show ""{newName}"""
Params=FOLDER
[Actions\Action9\Params]
icon=STRING|"1"
msg0=STRING|"{newName}"
msgcount=STRING|"1"
playsound=STRING|"0"
showmessage=STRING|"1"
can robotask save files with custom name?
Posted: Wed Dec 24, 2008 5:41 pm
by nick
Thanks Oleg, but I get this strange error:"The task contains UNKNOWN steps"The code whem imported:
can robotask save files with custom name?
Posted: Thu Dec 25, 2008 12:04 am
by Oleg
What version do you use?
can robotask save files with custom name?
Posted: Thu Dec 25, 2008 12:33 am
by Oleg
See below new edition of the task
;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|1380072790
ContinueOnError=INTEGER|0
ExternalName=STRING|"Task744"
Hide=INTEGER|0
ID=INTEGER|615134226
LogOnAsUser=INTEGER|1
Name=STRING|"Rename HTM files"
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_LOOP_FILE"
Enabled=INTEGER|-1
Name=STRING|"File Loop"
Params=FOLDER
[Actions\Action1\Params]
createmode=STRING|"1"
date1=STRING|"20081222"
date2=STRING|"20081222"
destvar=STRING|"C_HTM"
DuringDays=STRING|"1"
DuringMonths=STRING|"1"
file0=STRING|"c:\incoming\*.html"
filecount=STRING|"1"
OlderDays=STRING|"1"
OlderMonths=STRING|"1"
savesize=STRING|"0"
searchkind=STRING|"0"
subdirs=STRING|"1"
timesize=STRING|"0"
WithoutPath=STRING|"0"
[Actions\Action10]
ActionID=STRING|"A_LOOP_END"
Enabled=INTEGER|-1
Name=STRING|"End Loop"
[Actions\Action2]
ActionID=STRING|"A_LOOP_TEXT"
Enabled=INTEGER|-1
Name=STRING|"Text Loop"
Params=FOLDER
[Actions\Action2\Params]
destvar=STRING|"C_LINE"
file=STRING|"{c_htm}"
linecount=STRING|"0"
sourcetext=STRING|"0"
[Actions\Action3]
ActionID=STRING|"BASIC_SCRIPT"
Enabled=INTEGER|-1
Name=STRING|"Internal basic script"
Params=FOLDER
[Actions\Action3\Params]
line00000=STRING|"Sub Main"
line00001=STRING|"Dim s As String"
line00002=STRING|"Dim Nm As String"
line00003=STRING|"Dim pos1 As Integer"
line00004=STRING|"Dim pos2 As Integer"
line00005=STRING|"Dim l As Integer"
line00007=STRING|"Nm = """""
line00008=STRING|"s = RoboTaskApp.ExpandText(""{c_line}"")"
line00009=STRING|"pos1 = InStr(s,""<h1>"")"
line00011=STRING|"If pos1>0 Then"
line00012=STRING|" pos1 = pos1 + 4"
line00013=STRING|" pos2 = InStr(s,""</h1>"")"
line00014=STRING|" l = pos2 - pos1"
line00015=STRING|" Nm = Right(Left(s,pos2-1), l)"
line00016=STRING|"End If"
line00018=STRING|"RoboTaskApp.SetUserVariable(""newname"",Nm )"
line00020=STRING|"End Sub"
linecount=STRING|"21"
source=STRING|"0"
[Actions\Action4]
ActionID=STRING|"A_FLOW_IF"
Enabled=INTEGER|-1
Name=STRING|"If Then"
Params=FOLDER
[Actions\Action4\Params]
case=STRING|"0"
operator=STRING|"8"
type=STRING|"0"
value1=STRING|"{newname}"
value2=STRING|"0"
[Actions\Action5]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|0
Name=STRING|"Show ""{newName}"""
Params=FOLDER
[Actions\Action5\Params]
icon=STRING|"1"
msg0=STRING|"{newName}"
msgcount=STRING|"1"
playsound=STRING|"0"
showmessage=STRING|"1"
[Actions\Action6]
ActionID=STRING|"A_FILE_RENAME"
Enabled=INTEGER|-1
Name=STRING|"Rename File"
Params=FOLDER
[Actions\Action6\Params]
count=STRING|"1"
file0=STRING|"{c_htm}"
mask=STRING|"{newname}.*"
subdirs=STRING|"0"
[Actions\Action7]
ActionID=STRING|"A_LOOP_BREAK"
Enabled=INTEGER|-1
Name=STRING|"Break"
[Actions\Action8]
ActionID=STRING|"A_FLOW_ENDIF"
Enabled=INTEGER|-1
Name=STRING|"End If"
[Actions\Action9]
ActionID=STRING|"A_LOOP_END"
Enabled=INTEGER|-1
Name=STRING|"End Loop"
can robotask save files with custom name?
Posted: Thu Dec 25, 2008 8:09 am
by nick
Thank you, Oleg!