Extraction of certain lines from files

Discuss RoboTask here
Post Reply
Yurium
Posts: 2
Joined: Sun Sep 21, 2008 2:37 am

Extraction of certain lines from files

Post by Yurium »

I try to adjust the most powerful Robotask on performance of the following difficult task. While it turns out to adjust only partially. It is necessary to post different articles from different files through the same form. That is sequence such: there is text a file article1.txt. It is necessary to take a line from it containing heading (a line 1) and to insert in the field of the form, then to take a line with publication date (the line 2) and to put in the field of form date, then to take a body of article and to insert in 3 form field, then to press submit.
Further this cycle needs to be repeated with a following file in folder, that is to carry out sending of other article through the form.
For example, such article:
ASP.NET Blogging Software <------------------Heading, 1 line
21.09.2008 14:14:25 <------------------publication Date, 2 line
Of all of the different kinds of programs on the market <------------------article Body, the beginning 3 line
today, many people feel that Microsoft's recently
released ASP.NET blogging software is the most
advanced. In many ways, this particular program is
more adaptable and more versatile than any other
blogging software on the market. Although most of the
people who favour the program are accomplished coders
who are familiar with programming languages like html
and C ++, this new program from Microsoft is much
easier to use than a lot of other blog design software
that incorporates hands-on coding. One of the things
that makes ASP.NET stand apart from its competitors is
the fact that it allows designers to use a wide variety of
programming languages when they build a blog. This
means that a larger number of coders can realise their
dreams by programming in the language with which
they are most familiar and in which they are most
accomplished. <------------------article end, the file end,
number of last line can vary
depending on the size of each article,
but always it is the file end.
In shape I have adjusted operations with form, there are sent keystrokes, and here to take certain lines from each file and the more so to force this cycle to work for other files in a folder serially, it is impossible for me. Low bow, if Robotask can to make it therefore as universal enough algorithm turns out.
Oleg
Site Admin
Posts: 3014
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Extraction of certain lines from files

Post by Oleg »

This is a bit complex task.
Look at the example below. This task parses the text:
1-st line put into _1LINE variable
2-nd line - into _2LINE variable
and the rest of the file - into BODY variable

Next you may use these variables as you wish.
Save the text of the task into file and use menu "Task | Import" in order to import into RoboTask

;*****************************
;* RoboTask Task file       
;* Do not edit in text editor!
;*****************************

[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|700197831
ContinueOnError=INTEGER|0
ExternalName=STRING|"Task702"
Hide=INTEGER|0
ID=INTEGER|874911647
Name=STRING|"Parse text"
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|0
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
Action3=FOLDER
Action4=FOLDER
Action5=FOLDER
Action6=FOLDER
Action7=FOLDER
Action8=FOLDER
Action9=FOLDER

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

[Actions\Action1\Params]
expand=STRING|"0"
varname=STRING|"_1LINE"

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

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

[Actions\Action11\Params]
case=STRING|"0"
operator=STRING|"0"
type=STRING|"1"
value1=STRING|"{num_line}"
value2=STRING|"2"

[Actions\Action12]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""_2LINE"" with value ""{c_line}"""
Params=FOLDER

[Actions\Action12\Params]
expand=STRING|"1"
varname=STRING|"_2LINE"
varvalue=STRING|"{c_line}"

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

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

[Actions\Action14\Params]
case=STRING|"0"
operator=STRING|"3"
type=STRING|"1"
value1=STRING|"{num_line}"
value2=STRING|"2"

[Actions\Action15]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""BODY"" with value ""{body}{c_line}{Eol}"""
Params=FOLDER

[Actions\Action15\Params]
expand=STRING|"1"
varname=STRING|"BODY"
varvalue=STRING|"{body}{c_line}{Eol}"

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

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

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

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

[Actions\Action19]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show ""_1LINE:"""
Params=FOLDER

[Actions\Action19\Params]
icon=STRING|"1"
msg0=STRING|"_1LINE:"
msg1=STRING|"{_1LINE}"
msgcount=STRING|"2"
playsound=STRING|"0"
showmessage=STRING|"1"

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

[Actions\Action2\Params]
expand=STRING|"0"
varname=STRING|"_2LINE"

[Actions\Action20]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show ""_2LINE:"""
Params=FOLDER

[Actions\Action20\Params]
icon=STRING|"1"
msg0=STRING|"_2LINE:"
msg1=STRING|"{_2LINE}"
msgcount=STRING|"2"
playsound=STRING|"0"
showmessage=STRING|"1"

[Actions\Action21]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show ""BODY:"""
Params=FOLDER

[Actions\Action21\Params]
icon=STRING|"1"
msg0=STRING|"BODY:"
msg1=STRING|"{BODY}"
msgcount=STRING|"2"
playsound=STRING|"0"
showmessage=STRING|"1"

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

[Actions\Action3\Params]
expand=STRING|"0"
varname=STRING|"BODY"

[Actions\Action4]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show ""This task parses the text:"""
Params=FOLDER

[Actions\Action4\Params]
icon=STRING|"1"
msg0=STRING|"This task parses the text:"
msg1=STRING|"1-st line put into _1LINE variable"
msg2=STRING|"2-nd line - into _2LINE variable "
msg3=STRING|"and the rest of the file into BODY variable"
msg5=STRING|"Press Ok to choose the file"
msgcount=STRING|"6"
playsound=STRING|"0"
showmessage=STRING|"1"

[Actions\Action5]
ActionID=STRING|"A_DIALOG_OPEN"
Enabled=INTEGER|-1
Name=STRING|"Open Dialog"
Params=FOLDER

[Actions\Action5\Params]
caption=STRING|"Open File"
default=STRING|"None"
filter=STRING|"Text files|*.txt|All files|*.*|"
variable=STRING|"FILENAME"

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

[Actions\Action6\Params]
expand=STRING|"0"
varname=STRING|"NUM_LINE"
varvalue=STRING|"1"

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

[Actions\Action7\Params]
destvar=STRING|"C_LINE"
file=STRING|"{filename}"
linecount=STRING|"0"
sourcetext=STRING|"0"

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

[Actions\Action8\Params]
case=STRING|"0"
operator=STRING|"0"
type=STRING|"1"
value1=STRING|"{num_line}"
value2=STRING|"1"

[Actions\Action9]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""_1LINE"" with value ""{c_line}"""
Params=FOLDER

[Actions\Action9\Params]
expand=STRING|"1"
varname=STRING|"_1LINE"
varvalue=STRING|"{c_line}"
Yurium
Posts: 2
Joined: Sun Sep 21, 2008 2:37 am

Extraction of certain lines from files

Post by Yurium »


Big web masterful thanks for algorithm. With Robotask this difficult task was reduced from 9 actions by hands to 1.
I have noticed one feature when parsed the text is brought in the form. If article text contain words in other language, instead of them there is scribble. It it is possible to go through if to try not to use words speaking an another language. But links in texts meet very often. For example, parsed the text in russian will have the link to site http://getresponse.com such kind ðååç://ïóåêóûçùòûó.ñùü. Similar, that occurs to the coding.
Oleg
Site Admin
Posts: 3014
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Extraction of certain lines from files

Post by Oleg »

Hm-m-m... Maybe the current keyboard layout is Russian.
Try to use "Send as simple text" mode of sending keystrokes.
Post Reply