Page 1 of 1

reading logs

Posted: Wed Nov 06, 2019 8:27 pm
by Mr_Yaro
Hello everyone,

I have a log file that is being updated everyday. does anyone know how to check if specific string is present in that txt file?

thanks

Re: reading logs

Posted: Wed Nov 06, 2019 9:32 pm
by Oleg
Look at the task below.
Save the text of the task to a file and use menu Task->Import to import the task into RoboTask.

Code: Select all

;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
 
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|1181470169
Comment=STRINGLIST
ContinueOnError=INTEGER|0
DoNotStopWhenShutdown=INTEGER|0
ExternalName=STRING|"Task197"
Hide=INTEGER|0
ID=INTEGER|-887441753
LogOnAsUser=INTEGER|1
Name=STRING|"Check string in the text file"
OnErrorTaskID=INTEGER|-1
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3
UnicodeFormat=INTEGER|1
WriteGeneralLog=INTEGER|0

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

[Actions\Action1]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""FILENAME"" with value ""C:\incoming\test.txt"""
Params=FOLDER

[Actions\Action1\Params]
expand=STRING|"0"
varname=STRING|"FILENAME"
varvalue=STRING|"C:\incoming\test.txt"

[Actions\Action2]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""SUBSTRING"" with value ""Hello world"""
Params=FOLDER

[Actions\Action2\Params]
expand=STRING|"0"
varname=STRING|"SUBSTRING"
varvalue=STRING|"Hello world"

[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|"6"
type=STRING|"0"
value1=STRING|"{Substring}"
value2=STRING|"{TextFile({FileName})}"

[Actions\Action4]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show ""File ""{filename}"" contains the string ""{SubString}"""""
Params=FOLDER

[Actions\Action4\Params]
icon=STRING|"1"
msg0=STRING|"File ""{filename}"" contains the string ""{SubString}"""
msgcount=STRING|"1"
playsound=STRING|"0"
showmessage=STRING|"1"

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

[Actions\Action6]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show ""File ""{filename}"" doesn't contain the string ""{SubString}"""""
Params=FOLDER

[Actions\Action6\Params]
icon=STRING|"3"
msg0=STRING|"File ""{filename}"" doesn't contain the string ""{SubString}"""
msgcount=STRING|"1"
playsound=STRING|"0"
showmessage=STRING|"1"

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