modify / split text lines

Discuss RoboTask here
Post Reply
rice1973
Posts: 86
Joined: Mon Jan 04, 2010 2:38 am
Location: Netherlands
Contact:

modify / split text lines

Post by rice1973 »

Hi Oleg,I have to "modify" text lines in a CSV like this;CPRI,1112,4865,4866,4867,4868,4869should be tranformed to;





Normal
0


21


false
false
false

NL
X-NONE
X-NONE







































































































































































/* Style Definitions */
table.MsoNormalTable
{mso-style-name:"Table Normal";
mso-tstyle-rowband-size:0;
mso-tstyle-colband-s ize:0;
mso-style-noshow:yes;
mso-style-priority:99;
ms o-style-parent:"";
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin:0cm;
mso-para-margin-bottom:.0001 pt;
mso-pagination:widow-orphan;
font-size:11.0pt;
fon t-family:"Calibri","sans-serif";
mso-ascii-font-family:Cal ibri;
mso-ascii-theme-font:minor-latin;
mso-hansi-font-f amily:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bid i-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;
mso-fareast-lang uage:EN-US;}

CPRI,1112,4865CPRI,1112,4866CPRI,1112,4867CPRI,1112,4868CPRI,1112,4869Is that possible?Best regards,Maurice
Oleg
Site Admin
Posts: 3202
Joined: Thu Jan 01, 1970 1:00 am
Contact:

modify / split text lines

Post by Oleg »

Suppose we have variable
MyVar
contained the text
CPRI,1112,4865,4866,4867,4868,4869

Thus the required text will be such:
{MyVar(0)},{MyVar(1)},{MyVar(2)}
{MyVar(0)},{MyVar(1)},{MyVar(3)}
{MyVar(0)},{MyVar(1)},{MyVar(4)}
{MyVar(0)},{MyVar(1)},{MyVar(5)}
{MyVar(0)},{MyVar(1)},{MyVar(6)}
rice1973
Posts: 86
Joined: Mon Jan 04, 2010 2:38 am
Location: Netherlands
Contact:

modify / split text lines

Post by rice1973 »

Hi Oleg,It has mutiple, different textlines and can be between 1 and 10 varies long (after the first two values in the example "CPRI,1112" and "CPRI,1115");CPRI,1112,4865,4866,4867,4868,4869CPRI, 1115,5212,1515,2525,3626,2425,2625,1234,5678,4569,1258should be tranformed to;CPRI,1112,4865CPRI,1112,4866CPRI,1112,4867CPRI,1112,4868CPRI,1112,4869CPRI, 1115,5212CPRI, 1115,1515CPRI, 1115,2525CPRI, 1115,3626CPRI, 1115,2425CPRI, 1115,2625CPRI, 1115,1234CPRI, 1115,5678CPRI, 1115,4569CPRI, 1115,1258Please advice
Oleg
Site Admin
Posts: 3202
Joined: Thu Jan 01, 1970 1:00 am
Contact:

modify / split text lines

Post by Oleg »

Hm...
See the example below. It can parse dynamic string:

Code: Select all

;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
 
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|1380072790
ContinueOnError=INTEGER|0
ExternalName=STRING|"Task948"
Hide=INTEGER|0
ID=INTEGER|45935470
LocalVariables=STRING|"MyVar,cnt,DestText"
LogOnAsUser=INTEGER|1
Name=STRING|"modify / split text lines"
OnErrorTaskID=INTEGER|0
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3
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_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""MYVAR"" with value ""CPRI,1115,5212,1515,2525,3626,2425,2625,1234,5678,..."""
Params=FOLDER

[Actions\Action1\Params]
expand=STRING|"0"
varname=STRING|"MYVAR"
 varvalue=STRING|"CPRI,1115,5212,1515,2525,3626,2425,2625,123 4,5678,4569,1258"

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

[Actions\Action2\Params]
begin=STRING|"2"
end=STRING|"15"
variable=STRING|"CNT"

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

[Actions\Action3\Params]
case=STRING|"0"
operator=STRING|"8"
type=STRING|"0"
value1=STRING|"{MyVar({cnt})}"

[Actions\Action4]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""DESTTEXT"" with value ""{destText}{MyVar(0)},{MyVar({1})},{MyVar({cnt})}{E..."""
Params=FOLDER

[Actions\Action4\Params]
expand=STRING|"1"
varname=STRING|"DESTTEXT"
 varvalue=STRING|"{destText}{MyVar(0)},{MyVar({1})},{MyVar({c nt})}{EOL}"

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

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

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

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

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

[Actions\Action9\Params]
icon=STRING|"1"
msg0=STRING|"{destText}"
msgcount=STRING|"1"
playsound=STRING|"0"
showmessage=STRING|"1"
rice1973
Posts: 86
Joined: Mon Jan 04, 2010 2:38 am
Location: Netherlands
Contact:

modify / split text lines

Post by rice1973 »

Hi Oleg,Sorry for late reply, was on a exhibition.I can't get the job done.... Can you help me out more?Just send you an email.
Post Reply