DMXIS lightning control
-
I use Notepad ++ to change angle of my moving heads . I have a line that looks like this:
<Param nm=“32” v=“0.446789” = cc=“-1” nrpn=“-1” ch=“0” />)
<Param nm=“33” v=“0.362542” = cc=“-1” nrpn=“-1” ch=“0” />)
<Param nm=“34” v=“0.452683” = cc=“-1” nrpn=“-1” ch=“0” />)To find line 33:
Find:(?<=<Param nm=“33”).*?(?= cc=“-1” nrpn=“-1” ch=“0” />)Now I want to change the angle of the Moving Head
To change the line:
Replace: v=“0.250000”Now the angle of the Moving Head is 45 degrees and the line look like this:
<Param nm=“33” v=“0.250000” = cc=“-1” nrpn=“-1” ch=“0” />)Now I need to do this with Movinghead nr2 which is placed in line 48.
I want to change line 33 and line 48 simultaneously and wonder if this is possible to do? -
Hello Rune,
I’ve got a solution, using regular expressions ( as usual ! )
So let’s suppose the example text, below, with arbitrary values of the variable
v
:<Param nm="32" v="0.586945" = cc="-1" nrpn="-1" ch=“0” />) <Param nm="33" v="0.233658" = cc="-1" nrpn="-1" ch=“0” />) <Param nm="34" v="0.921623" = cc="-1" nrpn="-1" ch=“0” />) <Param nm="35" v="0.358415" = cc="-1" nrpn="-1" ch=“0” />) <Param nm="36" v="0.298455" = cc="-1" nrpn="-1" ch=“0” />) <Param nm="37" v="0.721562" = cc="-1" nrpn="-1" ch=“0” />) <Param nm="38" v="0.810025" = cc="-1" nrpn="-1" ch=“0” />) <Param nm="39" v="0.680256" = cc="-1" nrpn="-1" ch=“0” />) <Param nm="40" v="0.330886" = cc="-1" nrpn="-1" ch=“0” />) <Param nm="41" v="0.546025" = cc="-1" nrpn="-1" ch=“0” />) <Param nm="42" v="0.879620" = cc="-1" nrpn="-1" ch=“0” />) <Param nm="43" v="0.516289" = cc="-1" nrpn="-1" ch=“0” />) <Param nm="44" v="0.780254" = cc="-1" nrpn="-1" ch=“0” />) <Param nm="45" v="0.973065" = cc="-1" nrpn="-1" ch=“0” />) <Param nm="46" v="0.281435" = cc="-1" nrpn="-1" ch=“0” />) <Param nm="47" v="0.013562" = cc="-1" nrpn="-1" ch=“0” />) <Param nm="48" v="0.665812" = cc="-1" nrpn="-1" ch=“0” />) <Param nm="49" v="0.312802" = cc="-1" nrpn="-1" ch=“0” />) <Param nm="50" v="0.802891" = cc="-1" nrpn="-1" ch=“0” />)
Given a search in regular expression mode , the S/R, below, would match all text, between the string nn=“33” AND the string v=“0.665812”, located just after nm=“48” and changes the two values of the variable
v
, after "nm=“33” and nm=“48” to the same floating point number 0.250000SEARCH
(nm="33" v=")(.+?")(?s)(.+?nm="48" v=")(.+?")
REPLACE
${1}0.250000"${3}0.250000"
After clicking on, either, the Replace or the Replace All button, in the Replace dialog, we obtain the text, below :
<Param nm="32" v="0.586945" = cc="-1" nrpn="-1" ch=“0” />) <Param nm="33" v="0.250000" = cc="-1" nrpn="-1" ch=“0” />) <Param nm="34" v="0.921623" = cc="-1" nrpn="-1" ch=“0” />) <Param nm="35" v="0.358415" = cc="-1" nrpn="-1" ch=“0” />) <Param nm="36" v="0.298455" = cc="-1" nrpn="-1" ch=“0” />) <Param nm="37" v="0.721562" = cc="-1" nrpn="-1" ch=“0” />) <Param nm="38" v="0.810025" = cc="-1" nrpn="-1" ch=“0” />) <Param nm="39" v="0.680256" = cc="-1" nrpn="-1" ch=“0” />) <Param nm="40" v="0.330886" = cc="-1" nrpn="-1" ch=“0” />) <Param nm="41" v="0.546025" = cc="-1" nrpn="-1" ch=“0” />) <Param nm="42" v="0.879620" = cc="-1" nrpn="-1" ch=“0” />) <Param nm="43" v="0.516289" = cc="-1" nrpn="-1" ch=“0” />) <Param nm="44" v="0.780254" = cc="-1" nrpn="-1" ch=“0” />) <Param nm="45" v="0.973065" = cc="-1" nrpn="-1" ch=“0” />) <Param nm="46" v="0.281435" = cc="-1" nrpn="-1" ch=“0” />) <Param nm="47" v="0.013562" = cc="-1" nrpn="-1" ch=“0” />) <Param nm="48" v="0.250000" = cc="-1" nrpn="-1" ch=“0” />) <Param nm="49" v="0.312802" = cc="-1" nrpn="-1" ch=“0” />) <Param nm="50" v="0.802891" = cc="-1" nrpn="-1" ch=“0” />)
NOTES :
-
First, the part
(nm="33" v=")
matches the literal string nm=“33” v=" -
Secondly, the part
(.+?")
matches any non null range of characters, till the nearest double quote ("
) character, that is to say the string 0.233658" -
Thirdly, the part
(?s)(.+?nm="48" v=")
matches any non null range of characters, till the nearest string nm=“48” v=" -
Note that, in this third part, the
(?s)
in-line modifier forces the regex engine to consider any End of Line character as a standard character, matched by the ``.` dot meta-character. By this means, the match is extended through multiples lines, till it reaches the string nm=“48” v=" -
The last part
(.+?")
matches any non null range of characters, till the nearest double quote ("
) character, that is to say the string 0.665812" -
As these four parts are enclosed into round brackets, they determine four groups
-
In replacement, the groups 1 and 3 are just re-written, without any change and the groups 2 and 4 are changed into the literal string 0.250000"
-
As the digit
0
follows the group 1, we cannot use the syntax\10.25000...
, nor the other syntax$10.250000...
. In that case, the correct syntax is, only,${1}0.250000...
. And, idem for group 3
An other shorter syntax, but with some constraints, for this S/R, would be :
SEARCH
nm="33" v="\K(.+?")(?s)(.+?nm="48" v=")(.+?")
REPLACE
0.250000"${2}0.250000"
NOTES :
-
Due to the
\K
form, once the string nm=“33” v=" is matched, the regex engine forgets it. So, the entire matched string begins with 0.233658"…. -
Therefore, there are only 3 groups : groups -1 and 3, which are replaced by the string 0.250000" and group 2 which is, simply, rewritten
IMPORTANT :
-
Due the
\K
syntax, the step by step replacement, with the Replace button, does NOT work -
Moreover, do NOT try to process the search, first ! So, just locate your cursor before the text to be changed and click on the Replace all button, only !
Best Regards,
guy038
-
-
Thank You!!!
The show is now much easier to program:
Hit Station Live Måløydagane 2016