File Saerch

Discuss RoboTask here
Oleg
Site Admin
Posts: 3110
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Re: File Saerch

Post by Oleg »

Look at the example below
You should set file size to some variable in the "loop" step
Then you can compare file size with your value and do neccesary actions.

Code: Select all

;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
 
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|1163085779
Comment=STRINGLIST
ContinueOnError=INTEGER|0
DisableOnError=INTEGER|0
DoNotStopWhenShutdown=INTEGER|0
ExternalName=STRING|"Task1040"
Hide=INTEGER|0
ID=INTEGER|935581320
LogOnAsUser=INTEGER|1
Name=STRING|"skip files more 255 bytes"
OnErrorTaskID=INTEGER|1879502808
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
StepPause=INTEGER|0
ToLog=INTEGER|2
UnicodeFormat=INTEGER|1
WriteGeneralLog=INTEGER|0

[Actions]
Action1=FOLDER
Action2=FOLDER
Action3=FOLDER
Action4=FOLDER
Action5=FOLDER
Action6=FOLDER
Action7=FOLDER
Action8=FOLDER

[Actions\Action1]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""folder"" with value ""d:\incoming"""
Params=FOLDER

[Actions\Action1\Params]
_rt_variables_produced=STRING|"folder"
expand=STRING|"0"
linecount=STRING|"1"
varname=STRING|"folder"
varvalue=STRING|"d:\incoming"

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

[Actions\Action2\Params]
_rt_variables_produced=STRING|"FileName,sz"
createmode=STRING|"1"
date1=STRING|"20230808"
date2=STRING|"20230808"
destvar=STRING|"FileName"
DuringDays=STRING|"1"
DuringHours=STRING|"1"
DuringMinutes=STRING|"1"
DuringMonths=STRING|"1"
file0=STRING|"{folder}\*.*"
filecount=STRING|"1"
OlderDays=STRING|"1"
OlderHours=STRING|"1"
OlderMinutes=STRING|"1"
OlderMonths=STRING|"1"
savesize=STRING|"1"
savevar=STRING|"sz"
searchkind=STRING|"0"
sort=STRING|"0"
sortby=STRING|"0"
sortorder=STRING|"0"
subdirs=STRING|"0"
timesize=STRING|"0"
WithoutPath=STRING|"0"

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

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

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

[Actions\Action4\Params]
message=STRING|"File {FileName} skipped (more than 255 bytes)"
type=STRING|"1"

[Actions\Action5]
ActionID=STRING|"A_FLOW_ELSE"
Enabled=INTEGER|-1
Name=STRING|"Else"

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

[Actions\Action6\Params]
message=STRING|"File {FileName} must be processed"
type=STRING|"3"

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

[Actions\Action8]
ActionID=STRING|"A_LOOP_END"
Enabled=INTEGER|-1
Name=STRING|"End Loop"
Oleg Yershov
Danarlidge
Posts: 8
Joined: Thu Apr 13, 2023 9:45 am

Re: File Saerch

Post by Danarlidge »

Hi Oleg,

I hope all is well.

Thank you for the below. Is this possible with the file path length, not the file size?

https://learn.microsoft.com/en-us/windo ... s=registry

Kind Regards,
Dan Arlidge
Oleg wrote: Tue Aug 08, 2023 2:15 pm Look at the example below
You should set file size to some variable in the "loop" step
Then you can compare file size with your value and do neccesary actions.

Code: Select all

;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
 
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|1163085779
Comment=STRINGLIST
ContinueOnError=INTEGER|0
DisableOnError=INTEGER|0
DoNotStopWhenShutdown=INTEGER|0
ExternalName=STRING|"Task1040"
Hide=INTEGER|0
ID=INTEGER|935581320
LogOnAsUser=INTEGER|1
Name=STRING|"skip files more 255 bytes"
OnErrorTaskID=INTEGER|1879502808
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
StepPause=INTEGER|0
ToLog=INTEGER|2
UnicodeFormat=INTEGER|1
WriteGeneralLog=INTEGER|0

[Actions]
Action1=FOLDER
Action2=FOLDER
Action3=FOLDER
Action4=FOLDER
Action5=FOLDER
Action6=FOLDER
Action7=FOLDER
Action8=FOLDER

[Actions\Action1]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""folder"" with value ""d:\incoming"""
Params=FOLDER

[Actions\Action1\Params]
_rt_variables_produced=STRING|"folder"
expand=STRING|"0"
linecount=STRING|"1"
varname=STRING|"folder"
varvalue=STRING|"d:\incoming"

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

[Actions\Action2\Params]
_rt_variables_produced=STRING|"FileName,sz"
createmode=STRING|"1"
date1=STRING|"20230808"
date2=STRING|"20230808"
destvar=STRING|"FileName"
DuringDays=STRING|"1"
DuringHours=STRING|"1"
DuringMinutes=STRING|"1"
DuringMonths=STRING|"1"
file0=STRING|"{folder}\*.*"
filecount=STRING|"1"
OlderDays=STRING|"1"
OlderHours=STRING|"1"
OlderMinutes=STRING|"1"
OlderMonths=STRING|"1"
savesize=STRING|"1"
savevar=STRING|"sz"
searchkind=STRING|"0"
sort=STRING|"0"
sortby=STRING|"0"
sortorder=STRING|"0"
subdirs=STRING|"0"
timesize=STRING|"0"
WithoutPath=STRING|"0"

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

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

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

[Actions\Action4\Params]
message=STRING|"File {FileName} skipped (more than 255 bytes)"
type=STRING|"1"

[Actions\Action5]
ActionID=STRING|"A_FLOW_ELSE"
Enabled=INTEGER|-1
Name=STRING|"Else"

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

[Actions\Action6\Params]
message=STRING|"File {FileName} must be processed"
type=STRING|"3"

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

[Actions\Action8]
ActionID=STRING|"A_LOOP_END"
Enabled=INTEGER|-1
Name=STRING|"End Loop"
Zac
Posts: 18
Joined: Wed Feb 22, 2023 5:14 pm

Re: File Saerch

Post by Zac »

Solution for skipping files of 255 or more, what you can do is create an variable holder that we will call "VarLeng" and use the clipboard to copy the file address or whatever your trying to find the length of and then in an IF statement, choose the number type and in the first box type "{StrLength({VarLeng})}" and in the second box say 255 and then choose the arithmetic operator you want to use whether > or >= and then put your steps to complete if true or if it's false skip and move onto the next one. Apologies I didn't post the task for completing this like Oleg but hopes it helps! Also the {StrLenght()} is a system variables in the text and string category if you want to look at the other types of variable helpers there are!
Post Reply