Page 2 of 4

Re: Backup your tasks

Posted: Wed Jun 10, 2020 7:07 am
by psbtheone
Hi Oleg,

Thanks for your sharing this good task for backup of all tasks to a certain location. But, after exporting tasks, its difficult to identify a task by name in backup location, so i have created one subtask to be called from this backup task.

This subtask will read each task for its name and rename the task to its name before exporting it to a backup location.

Check this subtask:
ExportTaskWithName.tsk

Code: Select all

;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
 
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|1723571677
Comment=STRINGLIST
ContinueOnError=INTEGER|1
ExternalName=STRING|"Task39"
Hide=INTEGER|0
ID=INTEGER|368097659
LocalVariables=STRING|"CNT1=,name=,NAME1=,POSITION=,TEXT="
LogOnAsUser=INTEGER|1
Name=STRING|"ExportTasks"
OnErrorTaskID=INTEGER|-1
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3
UnicodeFormat=INTEGER|1
WriteGeneralLog=INTEGER|0

[Actions]
Action1=FOLDER
Action10=FOLDER
Action11=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|"20200307"
date2=STRING|"20200307"
destvar=STRING|"TSKFILE"
DuringDays=STRING|"1"
DuringHours=STRING|"1"
DuringMinutes=STRING|"1"
DuringMonths=STRING|"1"
file0=STRING|"{TaskFolder}\*.tsk"
filecount=STRING|"1"
OlderDays=STRING|"1"
OlderHours=STRING|"1"
OlderMinutes=STRING|"1"
OlderMonths=STRING|"1"
savesize=STRING|"0"
searchkind=STRING|"0"
sort=STRING|"1"
sortby=STRING|"1"
sortorder=STRING|"1"
subdirs=STRING|"1"
timesize=STRING|"0"
WithoutPath=STRING|"0"

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

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

[Actions\Action2]
ActionID=STRING|"A_LOOP_SIMPLE"
Enabled=INTEGER|-1
Name=STRING|"Simple Loop"
Params=FOLDER

[Actions\Action2\Params]
begin=STRING|"10"
end=STRING|"20"
variable=STRING|"CNT1"

[Actions\Action3]
ActionID=STRING|"A_TXT_EXTRACTLINE"
Enabled=INTEGER|-1
Name=STRING|"TXT Extract Line"
Params=FOLDER

[Actions\Action3\Params]
external=STRING|"1"
filename=STRING|"{TSKFILE}"
linecount=STRING|"0"
linenum=STRING|"{CNT1}"
variable=STRING|"TEXT"

[Actions\Action4]
ActionID=STRING|"A_STR_EXTRACT"
Enabled=INTEGER|-1
Name=STRING|"STR Extract"
Params=FOLDER

[Actions\Action4\Params]
amount=STRING|"13"
from=STRING|"1"
source=STRING|"{TEXT}"
variable=STRING|"position"

[Actions\Action5]
ActionID=STRING|"A_FLOW_IF"
Enabled=INTEGER|-1
Name=STRING|"If Then"
Params=FOLDER

[Actions\Action5\Params]
case=STRING|"1"
connection=STRING|"0"
count=STRING|"1"
operator=STRING|"0"
type=STRING|"0"
value1=STRING|"{POSITION}"
value2=STRING|"Name=STRING|"""

[Actions\Action6]
ActionID=STRING|"A_STR_EXTRACT"
Enabled=INTEGER|-1
Name=STRING|"STR Extract"
Params=FOLDER

[Actions\Action6\Params]
amount=STRING|"200"
from=STRING|"14"
source=STRING|"{TEXT}"
variable=STRING|"name"

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

[Actions\Action7\Params]
custom=STRING|"1"
customchar=STRING|""""
eol=STRING|"0"
lead=STRING|"1"
source=STRING|"{name}"
spaces=STRING|"0"
tabs=STRING|"0"
trailing=STRING|"1"
variable=STRING|"name1"

[Actions\Action8]
ActionID=STRING|"A_FILE_COPY"
Enabled=INTEGER|-1
Name=STRING|"Copy/Move File"
Params=FOLDER

[Actions\Action8\Params]
destdir=STRING|"{TODAYFOLDER}"
f_count=STRING|"1"
file0=STRING|"{TSKFILE}"
hidden=STRING|"1"
ifexists=STRING|"0"
move=STRING|"0"
rename=STRING|"1"
renamemask=STRING|"{name1}.tsk"
subdir=STRING|"0"
system=STRING|"1"

[Actions\Action9]
ActionID=STRING|"A_FLOW_ENDIF"
Enabled=INTEGER|-1
Name=STRING|"End If"


Re: Backup your tasks

Posted: Wed Jun 10, 2020 10:32 am
by Oleg
Very good.
Also look at the these demo tasks (included into installation package):
  • [DEMO] Retrieve task names - it creates the file map.txt in the task folder. Each line looks like this
    06C2F733 = Retrieve task names
    task_file_name = Task_name
  • [DEMO] Retrieve task parameters to CSV - it creates CSV file map.csv wth three fields:
    • Task_File_Name
      Task_Name
      Task_External_Name
    You can import this file into Excel and sort the list by any column

Re: Backup your tasks

Posted: Tue Apr 19, 2022 3:30 pm
by cagigas
Hello,

I am using version 9 of Robotask. I tried the task "Backup your tasks" but when deleting the old folders it gives me an error:

"Failed execute 'ExecAction with exception: File access denied' (C:\Program Files\RoboTask\Plugins\Files\FileMan.rtp)"

I don't have any other tasks accessing to that file. Any ideas?

Thanks
Oscar

Re: Backup your tasks

Posted: Thu Apr 21, 2022 10:59 am
by Oleg
May I have a look at your task?
"Failed execute 'ExecAction with exception: File access denied' (C:\Program Files\RoboTask\Plugins\Files\FileMan.rtp)"
C:\Program Files\RoboTask\Plugins\Files\FileMan.rtp is not a task, this is binary module of RoboTask.
It seems you want to remove binary modules of RoboTask and break RoboTask
Where do you want to save tasks?
the original example saves tasks in folder c:\TaskBackup
I use the similar task too for backup my tasks. It works without problem

Re: Backup your tasks

Posted: Fri Apr 29, 2022 11:26 am
by cagigas
Thanks Oleg for your reply. This is the task:

https://robotask.com/tasks/Demo/[DEMO]% ... ackup).tsk

Code: Select all

;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
 
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|0
CatID=INTEGER|10
Comment=STRINGLIST
ContinueOnError=INTEGER|0
DisableOnError=INTEGER|0
DoNotStopWhenShutdown=INTEGER|0
Events=FOLDER
ExternalName=STRING|"Task26"
Hide=INTEGER|0
ID=INTEGER|913310745
LogOnAsUser=INTEGER|1
Name=STRING|"[DEMO] Backup your tasks (daily backup) (imported)"
OnErrorTaskID=INTEGER|-1
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3
UnicodeFormat=INTEGER|1
WriteGeneralLog=INTEGER|0

[Actions]
Action1=FOLDER
Action10=FOLDER
Action11=FOLDER
Action12=FOLDER
Action13=FOLDER
Action14=FOLDER
Action15=FOLDER
Action16=FOLDER
Action17=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 ""BACKUPFOLDER"" with value ""c:\auto\RoboTaskBackup"""
Params=FOLDER

[Actions\Action1\Params]
expand=STRING|"1"
varkind=STRING|"1"
varname=STRING|"BACKUPFOLDER"
varvalue=STRING|"c:\auto\RoboTaskBackup"

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

[Actions\Action10\Params]
expand=STRING|"0"
varkind=STRING|"1"
varname=STRING|"OLDFOLDER"

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

[Actions\Action11\Params]
expand=STRING|"0"
varkind=STRING|"1"
varname=STRING|"CNT"
varvalue=STRING|"0"

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

[Actions\Action12\Params]
createmode=STRING|"1"
date1=STRING|"20130328"
date2=STRING|"20130328"
destvar=STRING|"OLDFOLDER"
DuringDays=STRING|"1"
DuringHours=STRING|"1"
DuringMinutes=STRING|"1"
DuringMonths=STRING|"1"
file0=STRING|"{BackupFolder}\*.*"
filecount=STRING|"1"
OlderDays=STRING|"1"
OlderHours=STRING|"1"
OlderMinutes=STRING|"1"
OlderMonths=STRING|"1"
savesize=STRING|"0"
searchkind=STRING|"1"
sort=STRING|"1"
sortby=STRING|"0"
sortorder=STRING|"1"
subdirs=STRING|"1"
timesize=STRING|"0"
WithoutPath=STRING|"0"

[Actions\Action13]
ActionID=STRING|"A_VARIABLES_INCREMENT"
Enabled=INTEGER|-1
Name=STRING|"Increment variable ""cnt"""
Params=FOLDER

[Actions\Action13\Params]
incement=STRING|"1"
vaiable=STRING|"cnt"

[Actions\Action14]
ActionID=STRING|"A_FLOW_IF"
Enabled=INTEGER|-1
Name=STRING|"If Then"
Params=FOLDER

[Actions\Action14\Params]
case=STRING|"0"
connection=STRING|"0"
count=STRING|"1"
operator=STRING|"3"
type=STRING|"1"
value1=STRING|"{Cnt}"
value2=STRING|"{BackupDays}"

[Actions\Action15]
ActionID=STRING|"A_FOLDER_REMOVE"
Enabled=INTEGER|-1
Name=STRING|"Remove Nonempty Folder  ({OldFolder})"
Params=FOLDER

[Actions\Action15\Params]
deletefolder=STRING|"1"
folder=STRING|"{OldFolder}"

[Actions\Action16]
ActionID=STRING|"A_FLOW_ENDIF"
Enabled=INTEGER|-1
Name=STRING|"End If"

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

[Actions\Action2]
ActionID=STRING|"A_VARIABLES_CREATE"
Enabled=INTEGER|-1
Name=STRING|"Create local variable ""TODAYFOLDER"" with value ""{BackupFolder}\{Year}{MonthNo}{Day}"""
Params=FOLDER

[Actions\Action2\Params]
expand=STRING|"1"
varkind=STRING|"1"
varname=STRING|"TODAYFOLDER"
varvalue=STRING|"{BackupFolder}\{Year}{MonthNo}{Day}"

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

[Actions\Action3\Params]
expand=STRING|"1"
varkind=STRING|"1"
varname=STRING|"BACKUPDAYS"
varvalue=STRING|"7"

[Actions\Action4]
ActionID=STRING|"A_FLOW_IF"
Enabled=INTEGER|-1
Name=STRING|"If Then"
Params=FOLDER

[Actions\Action4\Params]
case=STRING|"0"
connection=STRING|"0"
count=STRING|"1"
operator=STRING|"1"
type=STRING|"3"
value1=STRING|"{FileExists({TaskFolder}\*.tsk)}"

[Actions\Action5]
ActionID=STRING|"A_ROBOTASK_LOG"
Enabled=INTEGER|-1
Name=STRING|"Log Message"
Params=FOLDER

[Actions\Action5\Params]
message=STRING|"Wrong task folder. Reconfigure the task, please"
type=STRING|"2"

[Actions\Action6]
ActionID=STRING|"A_LOOP_BREAK"
Enabled=INTEGER|-1
Name=STRING|"Break"

[Actions\Action7]
ActionID=STRING|"A_FLOW_ENDIF"
Enabled=INTEGER|-1
Name=STRING|"End If"

[Actions\Action8]
ActionID=STRING|"A_FOLDER_SYNCHRONIZE"
Enabled=INTEGER|-1
Name=STRING|"Synchronize Folders"
Params=FOLDER

[Actions\Action8\Params]
clearro=STRING|"0"
details=STRING|"0"
detailstovar=STRING|"0"
exact=STRING|"0"
foder1=STRING|"{TaskFolder}"
foder2=STRING|"{TodayFolder}"
hidden=STRING|"0"
howsync=STRING|"1"
includeempty=STRING|"0"
includemask=STRING|"*.*"
subdir=STRING|"0"
system=STRING|"0"
twosecprecision=STRING|"1"

[Actions\Action9]
ActionID=STRING|"A_MISC_COMMENT"
Enabled=INTEGER|-1
Name=STRING|"//Now remove old backup folders"
Params=FOLDER

[Actions\Action9\Params]
comment=STRING|"Now remove old backup folders"

[Events]
Event1=FOLDER

[Events\Event1]
Enabled=INTEGER|-1
EventID=STRING|"E_FILE_MONITOR"
Name=STRING|"File Monitor"
Params=FOLDER
UniqueID=INTEGER|1287816954

[Events\Event1\Params]
chg=STRING|"1"
chga=STRING|"1"
chgsl=STRING|"1"
chgsm=STRING|"1"
chgtl=STRING|"1"
chgtm=STRING|"1"
del=STRING|"0"
folder1=STRING|"{TaskFolder}"
foldercount=STRING|"1"
incmask=STRING|"*.*"
interval=STRING|"60"
listmode=STRING|"1"
mon_files=STRING|"1"
mon_folders=STRING|"0"
new=STRING|"1"
pass=STRING|"0"
passmode=STRING|"1"
saveresults=STRING|"0"
subfolders1=STRING|"0"

The only change I did was to change the BACKUPFOLDER variable to c:\auto\RoboTaskBackup (from c:\TaskBackup)

From your reply I understand that maybe my installation is corrupted.

Re: Backup your tasks

Posted: Mon May 02, 2022 10:00 am
by Oleg
The only change I did was to change the BACKUPFOLDER variable to c:\auto\RoboTaskBackup (from c:\TaskBackup)
I've just tested your task. It works correctly.
save all tasks to folder C:\auto\RoboTaskBackup\20220502\ and don't try to remove RoboTask files

Re: Backup your tasks

Posted: Mon May 02, 2022 4:36 pm
by cagigas
Yes, mine too. But on the seventh day it starts failing when removing the folder.
Should I backup my tasks and reinstall the software?
What about admin rights or something?
Thanks

Image

Re: Backup your tasks

Posted: Mon May 02, 2022 5:32 pm
by Oleg
Maybe you use some non-standard permissions for backup folder.
I use this task for incremental backup long time without problem

Re: Backup your tasks

Posted: Mon May 02, 2022 5:36 pm
by Oleg
But on the seventh day it starts failing when removing the folder.
Can you remove old folder manually?

Re: Backup your tasks

Posted: Mon May 02, 2022 5:40 pm
by Oleg
I've just tested the task with many backup folders. It works!