Oh, yes, I do have a further question.
I’m writing a slash-cvt.vbee macro.
' This VBScript macro do the following:
' For a block of selected text,
' * if a / is found, replace all occurance of / to .
' * else if a is found, replace all to / .
' After the macro is executed, the converted text will remain at its select state(invert-colored).
Set ds = document.selection
slen = Len(ds.Text) ' get selected text length
posSlash = InStr(ds.Text, "/")
posBkSlash = InStr(ds.Text, "")
If posSlash>0 and (posBkSlash=0 or posBkSlash>posSlash) Then
' / in selected text and / appears before
ds.Text = Replace(ds.Text, "/", "")
ds.CharLeft True, slen 'make the new text in selected state(inverted color)
ElseIf posBkSlash>0 Then
' in selected text
ds.Text = Replace(ds.Text, "", "/")
ds.CharLeft True, slen
Set WshShell = CreateObject( "WScript.Shell" )
n = WshShell.Popup( "There is no / or in your selected text. This macro can do nothing.", 0, "EmEditor Macro running", 0 )
Set dc = document.config
crlf_style = dc.FileSave.ReturnMethod
WshShell.Popup "abc" & crlf_style
If the selection is partial line, or, multiple lines of a Unix text file, it works well. However, if the selection is multiple lines of a CRLF text file, there is something wrong:
ds.CharLeft True, slen will move(select) visually more characters than I expect, –because, at end of a line,
ds.CharLeft True, 1 will actually step 2 characters(CR and LF).
So, If I can know whether a text file is CRLF-ed, I can replace all CRLF to LF before I count slen=Len(ds.Text) , so that the finally selection length will be correct.
I hope you can add this property in future version. On the other hand, is there another way to achieve the same goal(implement the slash-cvt.vbee macro)?