stsMLXEditor, Notepad, Vista, Rev 3

Ken Ray kray at sonsothunder.com
Sun Sep 7 16:29:26 EDT 2008


> Ken, just to let you know, I've tried stsMLXEditor on Rev 2.9 on linux, and
> it behaves the same way as on Vista.  So it seems like it is not os-related,
> and nor is it confined to Rev 3.0

Hmm... it works fine on Rev 2.9 and 3.0 on OS X, but I think I found the
problem with Windows (at least). It seems the original example commands for
Windows were wrong. Here's what it says when you download it (for Notepad):

  put "%s" into tTmpFile
  put quote & "c:\\winnt\notepad.exe" & quote into tEditor
  get shell(tEditor && tTmpFile)

There are several things wrong with this:

1) The shell command is blocking, so it can't "watch" for changes while
you're editing in the external editor. This is remedied by adding "start" to
the shell command in line 3.

2) If you add quotes before the path in 'tEditor' and then try to pass that
in the shell command line with 'start', it fails. It is better then to pass
the 8.3 path name for the editor path (if you don't know it, you can execute
the "shortFilePath" function) since 'tTmpFile' is already 8.3 up to the last
item in the path, it works properly without quotes.

3) There was no addition of a line to hide the console window, so it looks
ugly going to/from.

4) The sample suggests your Windows directory is named "winnt", which likely
isn't true.

Here's the revised example for Notepad that works for me in Windows XP, Rev
2.9 (haven't tried Vista/3.0 yet):

  put  "%s"  into tTmpFile
  put  "c:\\windows\\notepad.exe" into tEditor
  set the hideconsolewindows to true
  get shell("start" && tEditor && tTmpFile)

Similarly, the WordPad example, which has a path with spaces in it, should
be (watch the line wraps):

  put  "%s"  into tTmpFile
  put  shortFilePath("c:\\program files\\windowsnt\\accessories\\
    wordpad.exe") into tEditor
  set the hideconsolewindows to true
  get shell("start" && tEditor && tTmpFile)

Here's the test I ran:

1) Expand the stsMLXEditor window
2) Click the "Active" checkbox
3) Click on the "Test" button (you should have the script of the test button
open in the specified external editor)
4) Make a change to the script in the external editor (I added a comment)
and make sure you save the changes in that editor.
5) Switch back to Rev, turn OFF the "Active" checkbox, and execute the
following statement in the Message Box:

  edit script of btn "Test" of stack "revMLXEditor"

The script should open in Rev's Script Editor, and show the changes you
made.

Let me know if it works for you; in the meantime I'll be updating
stsMLXEditor with the proper sample commands.

Ken Ray
Sons of Thunder Software, Inc.
Email: kray at sonsothunder.com
Web Site: http://www.sonsothunder.com/





More information about the use-livecode mailing list