External Script Editors (XSISDK)
This page covers tips for using external editors for XSI script authoring.
|Table of contents|
External Editor Preference
Starting with XSI v5.0 there is a preference for External Editor.
SetValue "preferences.scripting.externaleditor", "notepad"
Using Visual Studio .Net
Visual Studio .Net makes a good script editor, especially for developers who are already using it for C++ development. It understands JScript, VBScript syntax, has advanced Macro support and also supports Script Debugging.
However if you set your externaleditor preference to point to devenv.exe, by default it will create a new instance of Visual Studio. VSEdit (http://www.gotdotnet.com/team/ide/helpfiles/vsedit.aspx) is a possible alternative for reusing the same instance of Visual Studio.
The SciTE script editor is a good script editor that is completely free. It can be downloaded from http://www.scintilla.org/SciTE.html. However it has the problem that, when set as the external editor, it will launch a new instance of SciTE each time the ShowFileForEdit command is launched, so when using it extensively the same file may be opened in several different windows.
Linux developers who prefer to use vi, emacs or other editors can use the externaleditor preference
Modifying External Editor Behavior
The code for using the externaleditor preference is implemented in JScript, so it can be enhanced by changing the implementation of the ShowFileForEdit command. For example it might be desirable to change the code to decide on the editor based on the file extension, e.g. use an XML editor for .xml files, a code editor for script files and the native script editor for SPDL files.
Embedding an Editor
The problem with an external editor is that it runs as a separate process so it is not possible to directly run a script from within the editor.
However it is possible to embed an custom editor directly within XSI as a Custom Display Host. This would require some knowledge of C/C++ UI programming. XSI offers the Application.ExecuteScriptText method which can be hooked up to the "Run" button of a custom script editor.
Running Scripts From External Editor
One of the advantages of the XSI editor is that it has a run button to run a script directly as you write it. Once you are in an external script debugger you can't do this anymore - a script can only run inside the context of XSI. However if you are working on a self-installed plug-in this isn't such an issue anyway because "running" the script doesn't do anything. So in that case you will need to reload the plug-in inside XSI, following one of the solutions describes in Reloading Self-installed Plug-in DLLs without Restarting XSI