Hi,
I have a challenge on how to search/replace for multiple terms in a "template" and add the "processed" templates into a new file.
Example:
Template file:
return_Ref_ex1_V_summer = check_V_summer_on_return (return_Ref_ex1);
return_Ref_ex2_V_winter = check_V_winter_on_return (return_Ref_ex2);
return_Ref_ex_DN = check_DN_on_return (return_Ref_ex3);
Everywhere Ref_ex1 is written I want to exchange with a certain keyword e.g. pos_a1, Ref_ex2 to pos_a2, Ref_ex3 to pos_a3
But I also want to do the same 'procedure' for 'pos_b', 'pos_c' etc until 'pos_x'.
I hoped to have a file where I could specify how to exchange values - example:
Ref_ex1; pos_a1; Ref_ex2; pos_a1; Ref_ex3; pos_a3;
Ref_ex1; pos_b1; Ref_ex2; pos_b2; Ref_ex3; pos_b3;
etc.
But this could possibly be written in a much smarter way
I already made a setup where there is only one Ref_ex - i.e. only one keywork can be exchanged. I'm using 4 different open documents to do the this. 1: template, 2: workspace; 3: the 'translated' keywords; 4: the final document.
I tried using clipboard but for some reason they seems to be playing a trick on me - can't get them to work.
I'm using version 12.10a
Input much appreciated - and pls let me know if there is a lack of information
Best regards
Krivo
Present macro setup:
InsertMode
ColumnModeOff
HexOff
UnixReOff
Loop 50
SelectAll
StartSelect
Copy
EndSelect
NextDocument
Paste
NextDocument
GotoLine 1
Key HOME
StartSelect
Key END
IfSel
Else
ExitLoop
EndIf
Copy
PreviousDocument
Find RegExp "ref_ex"
Replace All "^c"
SelectAll
Copy
NextDocument
NextDocument
Paste
PreviousDocument
Key BACKSPACE
EndSelect
Key BACKSPACE
Key DEL
PreviousDocument
PreviousDocument
EndLoop
My 'translated' keyword document look like this:
pos_a
pos_b
pos_c
pos_d
pos_e
pos_f
pos_g
pos_h
pos_i
pos_j
pos_k
pos_l
pos_m
pos_n
pos_o
pos_p
pos_q
pos_r
pos_s
pos_t
pos_u
pos_v
pos_x
I have a challenge on how to search/replace for multiple terms in a "template" and add the "processed" templates into a new file.
Example:
Template file:
return_Ref_ex1_V_summer = check_V_summer_on_return (return_Ref_ex1);
return_Ref_ex2_V_winter = check_V_winter_on_return (return_Ref_ex2);
return_Ref_ex_DN = check_DN_on_return (return_Ref_ex3);
Everywhere Ref_ex1 is written I want to exchange with a certain keyword e.g. pos_a1, Ref_ex2 to pos_a2, Ref_ex3 to pos_a3
But I also want to do the same 'procedure' for 'pos_b', 'pos_c' etc until 'pos_x'.
I hoped to have a file where I could specify how to exchange values - example:
Ref_ex1; pos_a1; Ref_ex2; pos_a1; Ref_ex3; pos_a3;
Ref_ex1; pos_b1; Ref_ex2; pos_b2; Ref_ex3; pos_b3;
etc.
But this could possibly be written in a much smarter way
I already made a setup where there is only one Ref_ex - i.e. only one keywork can be exchanged. I'm using 4 different open documents to do the this. 1: template, 2: workspace; 3: the 'translated' keywords; 4: the final document.
I tried using clipboard but for some reason they seems to be playing a trick on me - can't get them to work.
I'm using version 12.10a
Input much appreciated - and pls let me know if there is a lack of information
Best regards
Krivo
Present macro setup:
InsertMode
ColumnModeOff
HexOff
UnixReOff
Loop 50
SelectAll
StartSelect
Copy
EndSelect
NextDocument
Paste
NextDocument
GotoLine 1
Key HOME
StartSelect
Key END
IfSel
Else
ExitLoop
EndIf
Copy
PreviousDocument
Find RegExp "ref_ex"
Replace All "^c"
SelectAll
Copy
NextDocument
NextDocument
Paste
PreviousDocument
Key BACKSPACE
EndSelect
Key BACKSPACE
Key DEL
PreviousDocument
PreviousDocument
EndLoop
My 'translated' keyword document look like this:
pos_a
pos_b
pos_c
pos_d
pos_e
pos_f
pos_g
pos_h
pos_i
pos_j
pos_k
pos_l
pos_m
pos_n
pos_o
pos_p
pos_q
pos_r
pos_s
pos_t
pos_u
pos_v
pos_x