Page 1 of 1
Help with simple but repetitive task
Posted: Wed Sep 04, 2013 6:46 pm
by puttyguy
Hello,
I'm trying to set up a macro that simply copies, pastes, and executes commands in SSH.
I have a list of files (in a plain text file) that I want to delete from server:
Code:
Code: Select all
rm -f "file1.htm"
rm -f "file2.htm"
rm -f "file3.htm"
rm -f "file4.htm"
rm -f "file5.htm"
rm -f "file6.htm"
... and many thousands more.
I simply want RoboTask to copy each line into Putty (one-by-one) and press enter, thus executing the command.
Any help is appreciated.
Re: Help with simple but repetitive task
Posted: Wed Sep 04, 2013 8:57 pm
by Oleg
The task will be similar to this example.
You can specify text in the loop directly. But you can specify external text file in the loop.
Code: Select all
;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|1503011508
Comment=STRINGLIST
ContinueOnError=INTEGER|0
ExternalName=STRING|"Task49"
Hide=INTEGER|0
ID=INTEGER|902018506
LogOnAsUser=INTEGER|1
Name=STRING|"Repetitive SFTP task"
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
Action4=FOLDER
Action5=FOLDER
Action6=FOLDER
Action7=FOLDER
[Actions\Action1]
ActionID=STRING|"A_VARIABLES_CREATE"
Enabled=INTEGER|-1
Name=STRING|"Create local variable ""CURRENTFILE"" with value """""
Params=FOLDER
[Actions\Action1\Params]
expand=STRING|"0"
varkind=STRING|"1"
varname=STRING|"CURRENTFILE"
[Actions\Action2]
ActionID=STRING|"A_VARIABLES_CREATE"
Enabled=INTEGER|-1
Name=STRING|"Create local variable ""OUT"" with value """""
Params=FOLDER
[Actions\Action2\Params]
expand=STRING|"0"
varkind=STRING|"1"
varname=STRING|"OUT"
[Actions\Action3]
ActionID=STRING|"A_SFTP_LOGON"
Enabled=INTEGER|-1
Name=STRING|"SFTP Open (username@servername)"
Params=FOLDER
[Actions\Action3\Params]
host=STRING|"servername"
password=STRING|"8300183858849008361683093"
passwordmode=STRING|"0"
port=STRING|"22"
username=STRING|"username"
[Actions\Action4]
ActionID=STRING|"A_LOOP_TEXT"
Enabled=INTEGER|-1
Name=STRING|"Text Loop"
Params=FOLDER
[Actions\Action4\Params]
destvar=STRING|"CURRENTFILE"
line0=STRING|"file1.htm"
line1=STRING|"file2.htm"
line2=STRING|"file3.htm"
line3=STRING|"file4.htm"
line4=STRING|"file5.htm"
line5=STRING|"file6.htm"
linecount=STRING|"6"
sourcetext=STRING|"1"
[Actions\Action5]
ActionID=STRING|"A_SFTP_COMMAND"
Enabled=INTEGER|-1
Name=STRING|"SFTP command (rm -f ""{CurrentFile}"")"
Params=FOLDER
[Actions\Action5\Params]
command=STRING|"rm -f ""{CurrentFile}"""
variable=STRING|"out"
[Actions\Action6]
ActionID=STRING|"A_ROBOTASK_LOG"
Enabled=INTEGER|-1
Name=STRING|"Log Message"
Params=FOLDER
[Actions\Action6\Params]
message=STRING|"{out}"
type=STRING|"3"
[Actions\Action7]
ActionID=STRING|"A_LOOP_END"
Enabled=INTEGER|-1
Name=STRING|"End Loop"
Save the task into a file and use menu Task->Import in order to import into RoboTask.