yes, of course. If we know the script works, then all that counts is the end-string, right? Even if there is a best practice among scripters (if there is one, please tell me) I cant do anything about it, because what I am looking for is a way to open ms-files defined in other peoples scripts. I can’t controll how everyone writes their code, but I can try to make a script that works with theirs 
This is what I ended up with so far, but it is not compatible with all kinds of cases (se below).
Also, please help me fine tune as much as you can.
(
fn GetMXSEditorWindowText hwnd =
(
local marshal = dotnetclass “System.Runtime.InteropServices.Marshal”
str = “”
try (
len = windows.sendmessage hwnd 0xE 0 0
lParam = marshal.AllocHGlobal (marshal.SystemDefaultCharSize*(len+1))
windows.sendmessage hwnd 0xD (len+1) lParam
ptr = dotnetobject "System.IntPtr" lParam
str = marshal.PtrToStringAuto ptr
marshal.FreeHGlobal ptr
) catch ()
str
)
g = (dotNetClass “Autodesk.Max.GlobalInterface”).Instance
hwnd = g.TheMxsEditorInterface.EditorGetEditHWND
main = g.TheMxsEditorInterface.EditorGetMainHWND
SCI_GETSELECTIONSTART = 2143
SCI_GETSELECTIONEND = 2145
start = windows.sendMessage hwnd SCI_GETSELECTIONSTART 0 0
end = windows.sendMessage hwnd SCI_GETSELECTIONEND 0 0
edit (substring (GetMXSEditorWindowText hwnd) (start+1) (end - start))
)
summary - please keep in mind that they are all working scripts. I am trying to apply this macroscript on “real life scripts”, that I download from developers websites or scriptspot and so on. I need this to work without the need to change the original script to make them work with mine:
$userScripts/subfolder/file.ms -- works
$userScripts\\folder\\file.ms -- does not work. Typing manually edit"$userScripts\\folder\\file.ms" works though
ScriptPath + "Folder\file.ms" -- does not work. Typing manually edit (ScriptPath + "Folder\file.ms) works though
((getdir #userScripts)+"\\folder\\file.ms") -- does not work. Typing manually edit((getdir #userScripts)+"\\folder\\file.ms") works though
There might be more cases and we need them all to work 
Regarding the ones that don’t work, my guess it is because of all the nested slashes and parenthesis and all.
How can this be solved?