textedit 2.5 limitation Thread last updated on 2003-10-11 00:59:38

Posted by member 7223 on 2003-09-01 00:59:17

Hi,

I'm fond about textedit and I've just found one limitation:
Let's say I have a directory "C:\Litestep\Wallpaper\0", if I call
!TextReplace @$rcfile$@ @StringToReplace @ @&"C:\Litestep\Wallpaper\0\"@

the "\0" in the path is replace by "StringToReplace " like if I had define some groups; with "(.*)". Then, the result will be:
StringToReplace "C:\Litestep\Wallpaper\StringToReplace \


Does anybody knows how to avoid this ?

Posted by member 36955 on 2003-09-01 01:32:16 link

well, the easiest way would be to use the backslash escape code:
!TextReplace @$rcfile$@ @StringToReplace @ @&"C:\\Litestep\\Wallpaper\\0"@

although if that filename is in an evar it wouldnt really be possible to avoid it

Posted by member 7223 on 2003-09-01 03:44:45 link

When I use stuff like textedit, there's evars and mz-vars almost everywhere...

Posted by member 37809 on 2003-09-01 08:30:05 link

Last time I tried I couldn't get any version of textedit with the new @ syntax to work with even plain strings...

Using two backslashes doesn't work with mz-vars and textedit, but four does.
*script exec !setlistsep \
*script exec !varset working "%{args}\end"
*script exec !varset path ""
*script label loop
*script exec !varset path "%{path}\\\\%{working:}"
*script exec !varset working "%{working:_}"
*script gotoif ("%{working}" = "end") done
*script goto loop
*script label done
*script exec !varremove working
*script exec !varset path "%{path:_}"
*script exec !varset path "%{path:_}"
*script exec !varset path "%{path:_}"
*script exec !varset path "%{path:_}"
*script exec !setlistsep :
; this I modified to the newer syntax (untested):
*script exec !textreplace @$rcfile$@ @^evarToReplace @ @&"%{path}"@

Posted by member 7223 on 2003-09-01 10:53:59 link

I understand the logic of this except the end (I just woke up and I have some trouble to keep my eyes open). Thanks; I will give it a try...
I always used textedit with @ syntax without problem. I have to read the doc of mzscript to see why it shouldn't work with...

Posted by member 37809 on 2003-09-01 11:10:26 link

(oops; edited the above post a little)
I don't understand why the modules' escape codes would in the end require four backslashes, but the above snippet works with textedit v2.1l using:
!textreplace "someFile" "^someEvar " "&\"%{path}\""

Posted by member 36955 on 2003-09-01 11:52:16 link

hmmm... i think i know why it needs four backslashes... im in the process of fixing a few things in textedit, ill see if i can fix that too

Posted by member 7223 on 2003-09-01 13:51:07 link

Hum, I've tried @"%{path}"@ but it doesn't work with new version of textedit.

There's a bug in textedit 2.5 that isn't in 2.4l:
After a while, the filename (only if it is given as an evar ?) will be completely messed up (with the rest of the !Textreplace line), and of course, the file will not be found. This doesn't happen if I switch back to 2.4l

Posted by member 36955 on 2003-09-01 14:27:18 link

yeah, that bug comes from the new \c escape code that is replaced by the contents of the clipboard... it tries to replace the \c in things like "..\config" in the file name and screws things up.. this is fixed in 2.51 that i just submitted, it should be available for download soon

Posted by member 7223 on 2003-09-01 15:37:20 link

LOL: I should have see this...

Posted by member 1 on 2003-09-01 15:39:12 link

tiz uploaded

Posted by member 7223 on 2003-09-01 21:25:00 link

I've upgrade to 2.51. Seems to work, but still need four backslashes with mzscript.

Big thanks to you all

Posted by member 36955 on 2003-09-02 16:15:12 link

try 2.52 that i just submitted for the four backslash problem

Posted by member 7223 on 2003-09-05 02:41:58 link

This is reactivity :)

Posted by member 7223 on 2003-10-11 00:59:38 link

Hi, 2.52 still need four backslashes