Discuss RoboTask here
Rukbunker
Posts: 218 Joined: Mon Feb 22, 2016 4:06 pm
Location: Netherlands
Post
by Rukbunker » Thu Jun 20, 2019 9:28 am
Hey Oleg,
The following lines needs to have text behind it. I want to use RegEx for it.
Code: Select all
3301354889
3301354890
3301354891
3301354892
3301354893
3301354894
3301354895
3301354896
3301354897
3301354898
3301354899
3301354900
3301354901
3301354902
3301354903
3301354904
3301354905
3301354906
3301354907
3301354908
The text which must be added is
Code: Select all
;;{ROOFTYPE};{Day}{MonthName}{Year}
I use the expression:
Expression Capture.PNG (4.58 KiB) Viewed 8537 times
The output is working, but....not completely. Although Multi-line is selected, he only seems to "convert" 2 lines and does that mutiple times. I assume it's a very simple solution.
Result Capture2.PNG (12.07 KiB) Viewed 8537 times
I searched the
tutorial for a solution, but I wasn't able to find any that works. And by the way: my RegEx skills are not that high.
Can you assist me?
Oleg
Site Admin
Posts: 3201 Joined: Thu Jan 01, 1970 1:00 am
Contact:
Post
by Oleg » Thu Jun 20, 2019 10:56 am
Look at my example
Code: Select all
;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|1040932817
Comment=STRINGLIST
ContinueOnError=INTEGER|0
DoNotStopWhenShutdown=INTEGER|0
ExternalName=STRING|"Task587"
Hide=INTEGER|0
ID=INTEGER|1699339497
LogOnAsUser=INTEGER|1
Name=STRING|"RegExp Replace..."
OnErrorTaskID=INTEGER|-1
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3
UnicodeFormat=INTEGER|1
WriteGeneralLog=INTEGER|0
[Actions]
Action1=FOLDER
[Actions\Action1]
ActionID=STRING|"A_REGEXP_REPLACE"
Enabled=INTEGER|-1
Name=STRING|"RegExp Replace"
Params=FOLDER
[Actions\Action1\Params]
anchored=STRING|"0"
case=STRING|"0"
extended=STRING|"0"
line00000000=STRING|"3301354889"
line00000001=STRING|"3301354890"
line00000002=STRING|"3301354891"
line00000003=STRING|"3301354892"
line00000004=STRING|"3301354893"
line00000005=STRING|"3301354894"
line00000006=STRING|"3301354895"
line00000007=STRING|"3301354896"
line00000008=STRING|"3301354897"
line00000009=STRING|"3301354898"
line0000000A=STRING|"3301354899"
line0000000B=STRING|"3301354900"
line0000000C=STRING|"3301354901"
line0000000D=STRING|"3301354902"
line0000000E=STRING|"3301354903"
line0000000F=STRING|"3301354904"
line00000010=STRING|"3301354905"
line00000011=STRING|"3301354906"
line00000012=STRING|"3301354907"
line00000013=STRING|"3301354908"
linecount=STRING|"20"
multiline=STRING|"0"
noautocapture=STRING|"0"
pattern=STRING|"(?m)^(.+)$"
replacementcount=STRING|"0"
replacemode=STRING|"0"
repline00000000=STRING|"$1;;{ROOFTYPE};{Day}{MonthName}{Year}"
replinecount=STRING|"1"
singleline=STRING|"0"
ungreedy=STRING|"0"
useexternal=STRING|"0"
variable=STRING|"result"
If you are not familiar with regular expressions you can modify this text in the loop without usage of regular expressions.
Also please note that variable
ROOFTYPE is undefined in your task
Oleg Yershov
Rukbunker
Posts: 218 Joined: Mon Feb 22, 2016 4:06 pm
Location: Netherlands
Post
by Rukbunker » Thu Jun 20, 2019 1:43 pm
that variable ROOFTYPE is undefined in your task
Correct. I was using the test function
Variable is being defined earlier in the task.
But thanks for the RegEx. To be honest: I wasnt even close to this. I wasn't able to solve this myself.
Oleg
Site Admin
Posts: 3201 Joined: Thu Jan 01, 1970 1:00 am
Contact:
Post
by Oleg » Thu Jun 20, 2019 2:18 pm
Look at the example without RegEx
Code: Select all
;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|1040932817
Comment=STRINGLIST
ContinueOnError=INTEGER|0
DoNotStopWhenShutdown=INTEGER|0
ExternalName=STRING|"Task589"
Hide=INTEGER|0
ID=INTEGER|1890653318
LogOnAsUser=INTEGER|1
Name=STRING|"Modify text without Regex"
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
[Actions\Action1]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""SOURCE"" with value ""3301354889{EOL}3301354890{EOL}3301354891{EOL}3301354892{EOL}3301354893{EOL}3301354894{EOL}3301354895{EOL}3301354896{EOL}3301354897{EOL}3301354898{EOL}3301354899..."""
Params=FOLDER
[Actions\Action1\Params]
expand=STRING|"0"
varname=STRING|"SOURCE"
varvalue=STRING|"3301354889{EOL}3301354890{EOL}3301354891{EOL}3301354892{EOL}3301354893{EOL}3301354894{EOL}3301354895{EOL}3301354896{EOL}3301354897{EOL}3301354898{EOL}3301354899{EOL}3301354900{EOL}3301354901{EOL}3301354902{EOL}3301354903{EOL}3301354904{EOL}3301354905{EOL}3301354906{EOL}3301354907{EOL}3301354908"
[Actions\Action2]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""RESULT"" with value """""
Params=FOLDER
[Actions\Action2\Params]
expand=STRING|"0"
varname=STRING|"RESULT"
[Actions\Action3]
ActionID=STRING|"A_LOOP_TEXT"
Enabled=INTEGER|-1
Name=STRING|"Text Loop"
Params=FOLDER
[Actions\Action3\Params]
destvar=STRING|"LINE"
line0=STRING|"{source}"
linecount=STRING|"1"
sourcetext=STRING|"1"
[Actions\Action4]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""RESULT"" with value ""{Result}{Line};;{ROOFTYPE};{Day}{MonthName}{Year}{EOL}"""
Params=FOLDER
[Actions\Action4\Params]
expand=STRING|"1"
varname=STRING|"RESULT"
varvalue=STRING|"{Result}{Line};;{ROOFTYPE};{Day}{MonthName}{Year}{EOL}"
[Actions\Action5]
ActionID=STRING|"A_LOOP_END"
Enabled=INTEGER|-1
Name=STRING|"End Loop"
[Actions\Action6]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show ""{result}"""
Params=FOLDER
[Actions\Action6\Params]
icon=STRING|"1"
msg0=STRING|"{result}"
msgcount=STRING|"1"
playsound=STRING|"0"
showmessage=STRING|"1"
Oleg Yershov