Finding new file

Discuss RoboTask here
Post Reply
Maugli
Posts: 1
Joined: Thu May 20, 2004 2:28 am
Location: Ukraine
Contact:

Finding new file

Post by Maugli »

Help me please how could i find & copy to other folder a newest file ? Is this possible ?
BrianSmith
Posts: 46
Joined: Tue Apr 27, 2004 7:50 pm

Finding new file

Post by BrianSmith »

;********************
; RoboTask Task file
; Do not edit!
;********************

[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|802282160
ExternalName=STRING|"Task7"
Hide=INTEGER|0
ID=INTEGER|782740870
Name=STRING|"Find the latest/newest modified file in a folder."
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3

[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_VARIABLES_CREATE"
Enabled=INTEGER|-1
Name=STRING|"Create variable ""LATEST_DATETIME"" with value ""01/01/1890 12:00:00"""
Params=FOLDER

[Actions\Action1\Params]
varname=STRING|"LATEST_DATETIME"
varvalue=STRING|"01/01/1890 12:00:00"

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

[Actions\Action11]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show ""The latest file is ({LATEST_FILENAME}) modified {LATEST_DATETIME}."""
Params=FOLDER

[Actions\Action11\Params]
icon=STRING|"1"
msg0=STRING|"The latest file is ({LATEST_FILENAME}) modified {LATEST_DATETIME}."
msg2=STRING|"You can now add another action to this task to copy this file wherever you like."
msgcount=STRING|"3"
playsound=STRING|"0"
showmessage=STRING|"1"

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

[Actions\Action2\Params]
createmode=STRING|"1"
date1=STRING|"20040520"
date2=STRING|"20040520"
destvar=STRING|"CURRENT_FILENAME"
DuringDays=STRING|"1"
DuringMonths=STRING|"1"
file0=STRING|"{TEMPDIR}\*.*"
filecount=STRING|"1"
OlderDays=STRING|"1"
OlderMonths=STRING|"1"
savesize=STRING|"0"
subdirs=STRING|"1"
timesize=STRING|"1"
timevar=STRING|"CURRENT_DATETIME"
WithoutPath=STRING|"1"

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

[Actions\Action3\Params]
message=STRING|"{CURRENT_DATETIME}"
type=STRING|"0"

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

[Actions\Action4\Params]
message=STRING|"{LATEST_DATETIME}"
type=STRING|"0"

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

[Actions\Action5\Params]
case=STRING|"0"
operator=STRING|"3"
type=STRING|"2"
value1=STRING|"{CURRENT_DATETIME}"
value2=STRING|"{LATEST_DATETIME}"

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

[Actions\Action6\Params]
message=STRING|"CURRENT_DATETIME {CURRENT_DATETIME} > LATEST_DATETIME {LATEST_DATETIME}"
type=STRING|"0"

[Actions\Action7]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""LATEST_FILENAME"" with value ""{CURRENT_FILENAME}"""
Params=FOLDER

[Actions\Action7\Params]
varname=STRING|"LATEST_FILENAME"
varvalue=STRING|"{CURRENT_FILENAME}"

[Actions\Action8]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""LATEST_DATETIME"" with value ""{CURRENT_DATETIME}"""
Params=FOLDER

[Actions\Action8\Params]
varname=STRING|"LATEST_DATETIME"
varvalue=STRING|"{CURRENT_DATETIME}"

[Actions\Action9]
ActionID=STRING|"A_FLOW_ENDIF"
Enabled=INTEGER|-1
Name=STRING|"End If"
BrianSmith
Posts: 46
Joined: Tue Apr 27, 2004 7:50 pm

Finding new file

Post by BrianSmith »

You may notice that this RoboTask does not work correctly or as you intended but I have raised the issue in a later topic in the forum which will be fixed in RoboTask 2.1

Please refer to this topic "Variable assignment critical error" for the problem. I will make modifications to this RoboTask when 2.1 is released and re-post it.

I am sure there are other ways of doing this but I will post my solution and I hope it helps.
Post Reply