Clear Log action

Post comments and suggestions for RoboTask here
OldGeek
Posts: 35
Joined: Thu Jun 01, 2023 2:50 pm
Location: Upstate NY

Re: Clear Log action

Post by OldGeek »

felipe wrote: Tue Jun 25, 2024 12:10 am I didn't add "Restart Robotask"
It is up to you when this will be done.
Thank You for sharing. I'm sure I'll use it.
Windows 11 Pro, RoboTask v10.0.2
OldGeek
Posts: 35
Joined: Thu Jun 01, 2023 2:50 pm
Location: Upstate NY

Re: Clear Log action

Post by OldGeek »

I'm working a version 2 of your idea. When I've tested it more, I'll post it here.
Windows 11 Pro, RoboTask v10.0.2
adhunkins
Posts: 9
Joined: Tue Mar 19, 2024 3:16 pm
Location: Minneapolis, MN
Contact:

Re: Clear Log action

Post by adhunkins »

This is a great workaround.

But I think there are certain functions that would be cleaner to have built into RoboTask.

There are many functions that you "could" patch for RoboTask using RoboTask. For example, RoboTask could have NO HOTKEYS (not even copy/paste) and you would have to build RoboTask hotkey triggers/tasks for any/all functions you wanted to activate with the keyboard rather than a mouse click. But why? I think the app should have common/useful actions built into the product even if it's theoretically possible to build a patch in RoboTask. ...just my 2 cents.
OldGeek
Posts: 35
Joined: Thu Jun 01, 2023 2:50 pm
Location: Upstate NY

Re: Clear Log action

Post by OldGeek »

Attached is my take on Clearing a log file; You select the specific logs and how many days of data to keep.

Code: Select all

;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
 
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|1332952927
Comment=STRINGLIST
ContinueOnError=INTEGER|2
DisableOnError=INTEGER|0
DoNotStopWhenShutdown=INTEGER|0
Events=FOLDER
ExternalName=STRING|"Task2"
Hide=INTEGER|0
ID=INTEGER|747979658
LogOnAsUser=INTEGER|1
Name=STRING|"Delete Temp Files Older Than 30 Days"
OnErrorTaskID=INTEGER|1879502808
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
StepPause=INTEGER|0
ToLog=INTEGER|1
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
Action18=FOLDER
Action19=FOLDER
Action2=FOLDER
Action20=FOLDER
Action21=FOLDER
Action22=FOLDER
Action23=FOLDER
Action24=FOLDER
Action25=FOLDER
Action26=FOLDER
Action27=FOLDER
Action28=FOLDER
Action29=FOLDER
Action3=FOLDER
Action30=FOLDER
Action31=FOLDER
Action32=FOLDER
Action33=FOLDER
Action34=FOLDER
Action35=FOLDER
Action36=FOLDER
Action37=FOLDER
Action38=FOLDER
Action39=FOLDER
Action4=FOLDER
Action5=FOLDER
Action6=FOLDER
Action7=FOLDER
Action8=FOLDER
Action9=FOLDER

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

[Actions\Action1\Params]
message=STRING|"====== [Start Task:] Delete Temp Files Old Than 30 Days"
type=STRING|"3"

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

[Actions\Action10\Params]
_rt_variables_produced=STRING|"Blanks"
expand=STRING|"0"
linecount=STRING|"0"
varkind=STRING|"1"
varname=STRING|"Blanks"

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

[Actions\Action11\Params]
_rt_variables_produced=STRING|"nCount"
begin=STRING|"1"
end=STRING|"50"
step=STRING|"1"
variable=STRING|"nCount"

[Actions\Action12]
ActionID=STRING|"A_STR_INSERT"
Enabled=INTEGER|-1
Name=STRING|"STR Insert"
Params=FOLDER

[Actions\Action12\Params]
_rt_variables_produced=STRING|"Blanks"
insert=STRING|" "
pos=STRING|"1"
source=STRING|"{Blanks}"
variable=STRING|"Blanks"

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

[Actions\Action14]
ActionID=STRING|"A_MISC_COMMENT"
Enabled=INTEGER|-1
Name=STRING|"//Search for old temp files"
Params=FOLDER

[Actions\Action14\Params]
comment=STRING|"Search for old temp files"

[Actions\Action15]
ActionID=STRING|"A_ROBOTASK_LOG"
Enabled=INTEGER|0
Name=STRING|"Log Message"
Params=FOLDER

[Actions\Action15\Params]
message=STRING|"[STEP: 15] Searching for Old Temp Files"
type=STRING|"3"

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

[Actions\Action16\Params]
_rt_variables_produced=STRING|"FileDateTime,FileToDelete"
createmode=STRING|"5"
createormodified=STRING|"1"
date1=STRING|"20040614"
date2=STRING|"20040614"
destvar=STRING|"FileToDelete"
DuringDays=STRING|"1"
DuringHours=STRING|"1"
DuringMinutes=STRING|"1"
DuringMonths=STRING|"1"
file0=STRING|"{TempDir}\*.*"
filecount=STRING|"1"
OlderDays=STRING|"30"
OlderHours=STRING|"1"
OlderMinutes=STRING|"1"
OlderMonths=STRING|"1"
savesize=STRING|"0"
searchkind=STRING|"0"
sort=STRING|"0"
sortby=STRING|"0"
sortorder=STRING|"0"
subdirs=STRING|"1"
timesize=STRING|"1"
timevar=STRING|"FileDateTime"
WithoutPath=STRING|"0"

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

[Actions\Action17\Params]
incement=STRING|"1"
vaiable=STRING|"FileCount"

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

[Actions\Action18\Params]
incement=STRING|"{FileSize({FileToDelete})}"
vaiable=STRING|"FileSize"

[Actions\Action19]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""strTemp"" with value """""
Params=FOLDER

[Actions\Action19\Params]
_rt_variables_produced=STRING|"strTemp"
expand=STRING|"0"
linecount=STRING|"0"
varname=STRING|"strTemp"

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

[Actions\Action2\Params]
message=STRING|"[STEP: 2] Today - 30 Days: {DateIncDays(-30)}"
type=STRING|"3"

[Actions\Action20]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""strTemp"" with value ""{FileToDelete}{Blanks}"""
Params=FOLDER

[Actions\Action20\Params]
_rt_variables_produced=STRING|"strTemp"
expand=STRING|"0"
linecount=STRING|"1"
varname=STRING|"strTemp"
varvalue=STRING|"{FileToDelete}{Blanks}"

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

[Actions\Action21\Params]
_rt_variables_produced=STRING|"strTemp"
amount=STRING|"50"
from=STRING|"1"
source=STRING|"{strTemp}"
variable=STRING|"strTemp"

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

[Actions\Action22\Params]
message=STRING|"[STEP: 22] Deleting File: {strTemp} - {FileDateTime}"
type=STRING|"3"

[Actions\Action23]
ActionID=STRING|"A_FILE_DELETE"
Enabled=INTEGER|-1
Name=STRING|"Delete File"
Params=FOLDER

[Actions\Action23\Params]
Count=STRING|"1"
deletedirs=STRING|"0"
deletereadonly=STRING|"0"
file0=STRING|"{FileToDelete}"
hidden=STRING|"1"
subdir=STRING|"0"
system=STRING|"1"
ToRecycleBin=STRING|"1"

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

[Actions\Action25]
ActionID=STRING|"A_MISC_COMMENT"
Enabled=INTEGER|-1
Name=STRING|"//Delete Empty Folders"
Params=FOLDER

[Actions\Action25\Params]
comment=STRING|"Delete Empty Folders"

[Actions\Action26]
ActionID=STRING|"A_ROBOTASK_LOG"
Enabled=INTEGER|0
Name=STRING|"Log Message"
Params=FOLDER

[Actions\Action26\Params]
message=STRING|"[STEP: 26] Searching for Empty Folders Older Than 30 Days"
type=STRING|"3"

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

[Actions\Action27\Params]
_rt_variables_produced=STRING|"EmptyFolder,FileDateTime"
createmode=STRING|"5"
createormodified=STRING|"1"
date1=STRING|"20091201"
date2=STRING|"20091201"
destvar=STRING|"EmptyFolder"
DuringDays=STRING|"1"
DuringHours=STRING|"1"
DuringMinutes=STRING|"1"
DuringMonths=STRING|"1"
file0=STRING|"{TempDir}\*.*"
filecount=STRING|"1"
OlderDays=STRING|"30"
OlderHours=STRING|"1"
OlderMinutes=STRING|"1"
OlderMonths=STRING|"1"
savesize=STRING|"0"
searchkind=STRING|"1"
sort=STRING|"0"
sortby=STRING|"0"
sortorder=STRING|"0"
subdirs=STRING|"0"
timesize=STRING|"1"
timevar=STRING|"FileDateTime"
WithoutPath=STRING|"0"

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

[Actions\Action28\Params]
case=STRING|"0"
connection=STRING|"0"
count=STRING|"1"
operator=STRING|"0"
type=STRING|"1"
value1=STRING|"{FilesCount({EmptyFolder})}"
value2=STRING|"0"

[Actions\Action29]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""strTemp"" with value """""
Params=FOLDER

[Actions\Action29\Params]
_rt_variables_produced=STRING|"strTemp"
expand=STRING|"0"
linecount=STRING|"0"
varname=STRING|"strTemp"

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

[Actions\Action3\Params]
_rt_variables_produced=STRING|"FileCount"
expand=STRING|"0"
linecount=STRING|"1"
varkind=STRING|"1"
varname=STRING|"FileCount"
varvalue=STRING|"0"

[Actions\Action30]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""strTemp"" with value ""{EmptyFolder}{Blanks}"""
Params=FOLDER

[Actions\Action30\Params]
_rt_variables_produced=STRING|"strTemp"
expand=STRING|"0"
linecount=STRING|"1"
varname=STRING|"strTemp"
varvalue=STRING|"{EmptyFolder}{Blanks}"

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

[Actions\Action31\Params]
_rt_variables_produced=STRING|"strTemp"
amount=STRING|"50"
from=STRING|"1"
source=STRING|"{strTemp}"
variable=STRING|"strTemp"

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

[Actions\Action32\Params]
message=STRING|"[STEP: 32] Deleting Empty Folder: {strTemp} - {FileDateTime}"
type=STRING|"3"

[Actions\Action33]
ActionID=STRING|"A_FOLDER_REMOVE"
Enabled=INTEGER|-1
Name=STRING|"Remove Empty Folder ({EmptyFolder})"
Params=FOLDER

[Actions\Action33\Params]
deletefolder=STRING|"0"
folder=STRING|"{EmptyFolder}"

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

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

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

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

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

[Actions\Action37\Params]
message=STRING|"[STEP: 38] Done, {FileCount} Files Deleted, ({FileSize} bytes)."
type=STRING|"3"

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

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

[Actions\Action39\Params]
message=STRING|"====== [End Task:] Delete Temp Files Old Than 30 Days"
type=STRING|"3"

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

[Actions\Action4\Params]
_rt_variables_produced=STRING|"FileSize"
expand=STRING|"0"
linecount=STRING|"1"
varkind=STRING|"1"
varname=STRING|"FileSize"
varvalue=STRING|"0"

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

[Actions\Action5\Params]
_rt_variables_produced=STRING|"FileToDelete"
expand=STRING|"0"
linecount=STRING|"0"
varkind=STRING|"1"
varname=STRING|"FileToDelete"

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

[Actions\Action6\Params]
_rt_variables_produced=STRING|"FileDateTime"
expand=STRING|"0"
linecount=STRING|"0"
varkind=STRING|"1"
varname=STRING|"FileDateTime"

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

[Actions\Action7\Params]
_rt_variables_produced=STRING|"EmptyFolder"
expand=STRING|"0"
linecount=STRING|"0"
varkind=STRING|"1"
varname=STRING|"EmptyFolder"

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

[Actions\Action8\Params]
_rt_variables_produced=STRING|"strTemp"
expand=STRING|"0"
linecount=STRING|"0"
varkind=STRING|"1"
varname=STRING|"strTemp"

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

[Actions\Action9\Params]
_rt_variables_produced=STRING|"nCount"
expand=STRING|"0"
linecount=STRING|"1"
varkind=STRING|"1"
varname=STRING|"nCount"
varvalue=STRING|"0"

[Events]
Event1=FOLDER

[Events\Event1]
Enabled=INTEGER|-1
EventID=STRING|"E_GENERAL_SHEDULER"
Name=STRING|"Scheduler(6/16/2023 12:00:00 PM)"
Params=FOLDER
UniqueID=INTEGER|-2067565362

[Events\Event1\Params]
periodicity=STRING|"0"
startdate=STRING|"45460"
time0=STRING|"25320000"
timecount=STRING|"1"
wakeup=STRING|"0"
Windows 11 Pro, RoboTask v10.0.2
adhunkins
Posts: 9
Joined: Tue Mar 19, 2024 3:16 pm
Location: Minneapolis, MN
Contact:

Re: Clear Log action

Post by adhunkins »

It's in the latest update!! Yay! :D Thank you, @Oleg!!
Post Reply