Jo Plaete

Visual Effects – 3D – Interactive Design

XSI External Script Editor

with 2 comments

Some people asked me about using an external script editor when writing python scripts for xsi since it’s very annoying that the internal script editor has no syntax highlighting and limited general script editing functions.

A solution for this which I’m personally quite happy with is having a little script in the internal script editor loading in external script files and execute them. So you can write your script in your desired text/script editor and when it comes to run it in xsi just run the little load and execute script.

For Python:

# Python Read and Execute File
# Path to the file
filePath = 'C://myScript.pys'
# Read in and execute
openfile = open(filePath, 'r')

Or(with control over the scripting language, only xsi):

# Python Read and Execute File
# Path to the file
filePath = 'C:/myScript.pys'
# Scripting Language: "Python" - "VBScript" - "JScript"
Language = 'Python'
# Read in and execute
Application.ExecuteScript(filePath, Language)

So just load this into you internal script editor, change the filePath and run.. (Of course don’t forget to save your file in your external editor before you run)

Note: the script you try to run should not end indented as that will give an error on executing.

An editor I quite like which has python syntax highlighting: notepad++



Written by Jo Plaete

April 29, 2008 at 8:46 pm

Posted in scripting, TD, XSI

2 Responses

Subscribe to comments with RSS.

  1. Works a dream, thanks! The lack of any kind of marking in the XSI script editor really gets annoying on the longer scripts :/

    A note to other users though – when copying the above code, don’t forget to retype the inverted commas, as sometime the copied ones make trouble. Also, be careful you don’t have any spaces in your filepath. Python doesn’t like it. This can create some hassle especially under Windows, where by default all of the user’s documents get saved under “Documents and Settings”.

    Nic Groot Bluemink

    April 29, 2008 at 10:59 pm

  2. @Nic Groot Bluemink: Indeed! Cheers


    April 30, 2008 at 1:42 am

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: