Read through text file

Discuss RoboTask here
Post Reply
timjones
Posts: 1
Joined: Wed May 26, 2021 7:15 pm

Read through text file

Post by timjones »

I need to read through a .txt file which has multiple lines that are delimited. These need to be processed one at a time. I have tasks that can do one line in a file, but am unsure how to do this for multiple lines.
Oleg
Site Admin
Posts: 3000
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Re: Read through text file

Post by Oleg »

look at this simple example.
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|1163085779
Comment=STRINGLIST
ContinueOnError=INTEGER|0
DisableOnError=INTEGER|0
DoNotStopWhenShutdown=INTEGER|0
ExternalName=STRING|"Task1401"
Hide=INTEGER|0
ID=INTEGER|385478111
LogOnAsUser=INTEGER|1
Name=STRING|"Text Loop..."
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

[Actions\Action1]
ActionID=STRING|"A_LOOP_TEXT"
Enabled=INTEGER|-1
Name=STRING|"Text Loop"
Params=FOLDER

[Actions\Action1\Params]
destvar=STRING|"LINE"
file=STRING|"C:\temp\mytext.txt"
linecount=STRING|"0"
sourcetext=STRING|"0"

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

[Actions\Action2\Params]
message=STRING|"{line}"
type=STRING|"3"

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

Oleg Yershov
Post Reply