Notifications
Clear all

[Closed] Open an .ms file with Edit()

no-worked line because of wrong syntax
if you get right path , use getFilenamePath + filenameFromPath all syntax works , just need to case parametric with execute method

+1

try this

substr = execute (substring (GetMXSEditorWindowText hwnd) (start+1) (end - start))
edit substr

Thank you very much! It works now

Is it possible to foolproof this script? If I miss the first and/or last ” for example, I get an error.
Another thing was if I got one ( or ) too many, then I get errors too.

How can we get a nicer warning, eg explaining the proper use of this script? Or simply not do anything? Or if possible, make it intelligent and have the script add a first/last ” for us? What do you think?

You can trim not needed characters

trimLeft “apple” “a”
trimRight “apple” “e”
trimRight (trimLeft “apple” “a”) “e”

“pple”
“appl”
“ppl”

I doubt that you’ll find a ready solution to your problem.
As long as you depend on any local variable in someone’s script it is unlikely that you will be able to make a proper path.

Maybe A final try then: is there a way in maxscript to verify if a string is a valid path? With a friendly way (as opposed to an aggressive error message like the ones I get now) to tell us true or false?

Sure, check out doesFileExist and pathConfig struct methods.

Page 2 / 2