Page 1 of 1

textfile/folder substring match

Posted: Mon Jan 21, 2013 7:52 pm
by Naras
I'm creating a task that extracts a string from a text file. I want to use that string to find a file that contains the string in it's name in a different folder.The text file is an email log in which I'm extracting the message id then using that id to find the file(the actual email) from a \sent folder  so I can extract certain info from it. The email log will contain up to 100 entries in any given day and will run everyday at 2:00 AM to extract entries for the previous day. The series of stepsText loop extracts the message id from the email log.Search the sent folder for the file containing the string.Parse the corresponding (Email) file for information.Write text file with informationMove on to the next message id number. Repeat for all the entries in the email log.So far I used a text loop to extract the string from the text file with a file loop inside the text loop and  an if/then statement to find the string in the name of one of the files in the folder so I can parse the actual email. Can't seem to get it to work. Thought's








textfile/folder substring match

Posted: Tue Jan 22, 2013 5:34 am
by Oleg
Could you send the following information to me ( oleg(at)robotask.com ):
- your task you created;
- example of email log;
- several examples of email files in "sent" folder.

I want to look at this, maybe I can help you.

textfile/folder substring match

Posted: Mon Jan 28, 2013 7:47 pm
by Naras
Hi Oleg, Thanks so much for offering to help with my Task. I did finally get it to work. However, I have a different question.I have an email to process example below. I'm using a text loop to parse the email from an Email log.I need to get all the RCPT Lines into one variable that I can use in a report. I'm extracting different parts of the email into separate variables, ie; FRom into MSGFrom, To into MSGTO, Subject into MSGSUB etc.I want to extract all of the "RCPT TO:" lines into one variable.I have not been able to figure how to get more than one value into the variable at a time(the last line that it falls on in the email ). The amount of lines that "RCPT" falls on varies with each email.HOST mail.*.comPORT *HELO MAIL FROM: <*.mail@*.com>RCPT TO: <*@*.com>RCPT TO: <*@*.com>RCPT TO: <*@*.com>RCPT TO: <*@*.com>RCPT TO: <*@*.com>RCPT TO: <*@*.com>RCPT TO: <*@*.com>DATAFrom: "Someone" <*@*.com>To: <*@*.com>Cc: <*@*.com>, <*@*.com>, <*@*.com>,<*@*.com>, <*@*.com>.comDate:Subject:Body:Any help much appreciated!




textfile/folder substring match

Posted: Wed Jan 30, 2013 5:38 am
by Oleg
Look at the example below.
I hope this will help you

Code: Select all

;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
 
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|2099193306
Comment=STRINGLIST
ContinueOnError=INTEGER|0
ExternalName=STRING|"Task20"
Hide=INTEGER|0
ID=INTEGER|1058349080
LogOnAsUser=INTEGER|1
Name=STRING|"Parse mail log"
OnErrorTaskID=INTEGER|0
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3
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
Action22=FOLDER
Action23=FOLDER
Action24=FOLDER
Action25=FOLDER
Action26=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 local variable ""CLINE"" with value """""
Params=FOLDER

[Actions\Action1\Params]
expand=STRING|"0"
varkind=STRING|"1"
varname=STRING|"CLINE"

[Actions\Action10]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""MSGRCPT"" with value ""{MSGRCPT}{cline}{EOL}"""
Params=FOLDER

[Actions\Action10\Params]
expand=STRING|"1"
varname=STRING|"MSGRCPT"
varvalue=STRING|"{MSGRCPT}{cline}{EOL}"

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

[Actions\Action12]
ActionID=STRING|"A_STR_POS"
Enabled=INTEGER|-1
Name=STRING|"STR Pos"
Params=FOLDER

[Actions\Action12\Params]
case=STRING|"0"
from=STRING|"1"
search=STRING|"FROM:"
source=STRING|"{cline}"
variable=STRING|"pos"

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

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

[Actions\Action14]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""MSGFROM"" with value ""{cline}"""
Params=FOLDER

[Actions\Action14\Params]
expand=STRING|"1"
varname=STRING|"MSGFROM"
varvalue=STRING|"{cline}"

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

[Actions\Action16]
ActionID=STRING|"A_STR_POS"
Enabled=INTEGER|-1
Name=STRING|"STR Pos"
Params=FOLDER

[Actions\Action16\Params]
case=STRING|"0"
from=STRING|"1"
search=STRING|"TO:"
source=STRING|"{cline}"
variable=STRING|"pos"

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

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

[Actions\Action18]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""MSGTO"" with value ""{MSGTO}{cline}{EOL}"""
Params=FOLDER

[Actions\Action18\Params]
expand=STRING|"1"
varname=STRING|"MSGTO"
varvalue=STRING|"{MSGTO}{cline}{EOL}"

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

[Actions\Action2]
ActionID=STRING|"A_VARIABLES_CREATE"
Enabled=INTEGER|-1
Name=STRING|"Create local variable ""MSGRCPT"" with value """""
Params=FOLDER

[Actions\Action2\Params]
expand=STRING|"0"
varkind=STRING|"1"
varname=STRING|"MSGRCPT"

[Actions\Action20]
ActionID=STRING|"A_STR_POS"
Enabled=INTEGER|-1
Name=STRING|"STR Pos"
Params=FOLDER

[Actions\Action20\Params]
case=STRING|"0"
from=STRING|"1"
search=STRING|"SUBJECT:"
source=STRING|"{cline}"
variable=STRING|"pos"

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

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

[Actions\Action22]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""MSGSUB"" with value ""{cline}"""
Params=FOLDER

[Actions\Action22\Params]
expand=STRING|"1"
varname=STRING|"MSGSUB"
varvalue=STRING|"{cline}"

[Actions\Action23]
ActionID=STRING|"A_LOOP_BREAK"
Enabled=INTEGER|-1
Name=STRING|"Break"

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

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

[Actions\Action26]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show ""{msgrcpt}"""
Params=FOLDER

[Actions\Action26\Params]
icon=STRING|"1"
msg0=STRING|"{msgrcpt}"
msg1=STRING|"{msgto}"
msg2=STRING|"{msgfrom}"
msg3=STRING|"{msgsub}"
msgcount=STRING|"4"
playsound=STRING|"0"
showmessage=STRING|"1"

[Actions\Action3]
ActionID=STRING|"A_VARIABLES_CREATE"
Enabled=INTEGER|-1
Name=STRING|"Create local variable ""MSGTO"" with value """""
Params=FOLDER

[Actions\Action3\Params]
expand=STRING|"0"
varkind=STRING|"1"
varname=STRING|"MSGTO"

[Actions\Action4]
ActionID=STRING|"A_VARIABLES_CREATE"
Enabled=INTEGER|-1
Name=STRING|"Create local variable ""MSGFROM"" with value """""
Params=FOLDER

[Actions\Action4\Params]
expand=STRING|"0"
varkind=STRING|"1"
varname=STRING|"MSGFROM"

[Actions\Action5]
ActionID=STRING|"A_VARIABLES_CREATE"
Enabled=INTEGER|-1
Name=STRING|"Create local variable ""MSGSUB"" with value """""
Params=FOLDER

[Actions\Action5\Params]
expand=STRING|"0"
varkind=STRING|"1"
varname=STRING|"MSGSUB"

[Actions\Action6]
ActionID=STRING|"A_VARIABLES_CREATE"
Enabled=INTEGER|-1
Name=STRING|"Create local variable ""POS"" with value """""
Params=FOLDER

[Actions\Action6\Params]
expand=STRING|"0"
varkind=STRING|"1"
varname=STRING|"POS"

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

[Actions\Action7\Params]
destvar=STRING|"CLINE"
line0=STRING|"HOST mail.domain.com"
line1=STRING|"PORT *"
line10=STRING|"RCPT TO: <seven@domain7.com>"
line11=STRING|"DATA"
line12=STRING|"From: ""Someone"" <one.mail@domain.com>"
line13=STRING|"To: <one@domain1.com>"
line14=STRING|"Cc: <two@domain2.com>,"
line15=STRING|" <three@domain3.com>,"
line16=STRING|" <four@domain4.com>,"
line17=STRING|" <five@domain5.com>,"
line18=STRING|" <six@domain6.com>,"
line19=STRING|" <seven@domain7.com>"
line2=STRING|"HELO "
line20=STRING|"Date:"
line21=STRING|"Subject: Some subject of the message"
line22=STRING|"Body: Hello everybody!!!"
line23=STRING|"This is a test messge"
line3=STRING|"MAIL FROM: <one.mail@domain.com>"
line4=STRING|"RCPT TO: <one@domain1.com>"
line5=STRING|"RCPT TO: <two@domain2.com>"
line6=STRING|"RCPT TO: <three@domain3.com>"
line7=STRING|"RCPT TO: <four@domain4.com>"
line8=STRING|"RCPT TO: <five@domain5.com>"
line9=STRING|"RCPT TO: <six@domain6.com>"
linecount=STRING|"24"
sourcetext=STRING|"1"

[Actions\Action8]
ActionID=STRING|"A_STR_POS"
Enabled=INTEGER|-1
Name=STRING|"STR Pos"
Params=FOLDER

[Actions\Action8\Params]
case=STRING|"0"
from=STRING|"1"
search=STRING|"RCPT TO:"
source=STRING|"{cline}"
variable=STRING|"pos"

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

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