take random word from many words in subject of email

Discuss RoboTask here
Post Reply
crisp212
Posts: 21
Joined: Mon Dec 04, 2017 7:12 pm

take random word from many words in subject of email

Post by crisp212 »

Good morning Oleg.

Still trying your software and is amazing what it can do. I am trying this now and need help:

I want that when I receive a mail with the subject “Alert in xxxx/xxxx”, “ xxxx/xxxx” show it on screen.

So for example, Receive an email with “Alert in Miami/Florida” or "Alert in Sacramento/California" or other random city, then pop ups a screen with “Miami/Florida is having problems” or "Sacramento/California is having problems". xxx is a random incoming string but always after "Alert in"

I got all the email correctly (IMAP, etc.) but I don’t know how to take the "xxx" to variable automatically.

Regards,

D.
Last edited by crisp212 on Tue Dec 12, 2017 2:20 pm, edited 1 time in total.
Oleg
Site Admin
Posts: 3004
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Re: take random word from many words in subject of email

Post by Oleg »

I think you have to use regular expressions.
Look at my example 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|444033236
Comment=STRINGLIST
ContinueOnError=INTEGER|0
ExternalName=STRING|"Task3"
Hide=INTEGER|0
ID=INTEGER|14240530
LogOnAsUser=INTEGER|1
Name=STRING|"Random word"
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
Action8=FOLDER
Action9=FOLDER

[Actions\Action1]
ActionID=STRING|"A_VARIABLES_CREATE"
Enabled=INTEGER|-1
Name=STRING|"Create local variable ""LIST"" with value ""Alert in Chicago{EOL}Some other string{EOL}Alert in Houston{EOL}Alert in New York{EOL}alert in Los Angeles """
Params=FOLDER

[Actions\Action1\Params]
expand=STRING|"0"
varkind=STRING|"1"
varname=STRING|"LIST"
varvalue=STRING|"Alert in Chicago{EOL}Some other string{EOL}Alert in Houston{EOL}Alert in New York{EOL}alert in Los Angeles "

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

[Actions\Action2\Params]
destvar=STRING|"LINE"
line0=STRING|"{list}"
linecount=STRING|"1"
sourcetext=STRING|"1"

[Actions\Action3]
ActionID=STRING|"A_REGEXP_MATCH"
Enabled=INTEGER|-1
Name=STRING|"RegExp Match"
Params=FOLDER

[Actions\Action3\Params]
anchored=STRING|"0"
case=STRING|"1"
extended=STRING|"0"
line00000000=STRING|"{Line}"
linecount=STRING|"1"
multiline=STRING|"0"
noautocapture=STRING|"0"
pattern=STRING|"Alert in (.+)$"
savesubexpression=STRING|"1"
singleline=STRING|"0"
subexpressionpos=STRING|"0"
subexpressionvar=STRING|"expr"
ungreedy=STRING|"0"
useexternal=STRING|"0"
variable=STRING|"match"

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

[Actions\Action4\Params]
case=STRING|"0"
connection=STRING|"0"
count=STRING|"1"
operator=STRING|"0"
type=STRING|"3"
value1=STRING|"{match}"

[Actions\Action5]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show ""Sourse line: {Line}"""
Params=FOLDER

[Actions\Action5\Params]
icon=STRING|"1"
msg0=STRING|"Sourse line: {Line}"
msg1=STRING|"Composed line: {expr(1)} is having problems"
msgcount=STRING|"2"
playsound=STRING|"0"
showmessage=STRING|"1"

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

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

[Actions\Action7\Params]
icon=STRING|"0"
msg0=STRING|"{Line}"
msg1=STRING|"***************"
msg2=STRING|"Expression is not matched"
msgcount=STRING|"3"
playsound=STRING|"0"
showmessage=STRING|"1"

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

[Actions\Action9]
ActionID=STRING|"A_LOOP_END"
Enabled=INTEGER|-1
Name=STRING|"End Loop"
Oleg Yershov
Post Reply