Simon Willison’s Weblog

Subscribe

PythonCard scriptlets

27th October 2002

Kevin Altis on scripting applications written in PythonCard:

The entire object model of a PythonCard application is exposed, so if an app doesn’t have the feature you want, you can probably extend it with a short “macro” in Python. All scripts are run in the shell, so they share the shell namespace and thus scripts can share variables since the namespace doesn’t go away until the application is closed.

Kevin calls these scripts “scriptlets” and has posted an example scriptlet that can insert the current date and time straight in to any text file opened with the PythonCard codeEditor.

Sam Ruby was recently quoted as stating the following over on Jon Udell’s blog:

While Java and C# battle over who is the rightful successor to C++, it is quite possible that a language like Python (or, dare I say it, Ruby) will ultimately be the one that wins out.

This is an interesting train of thought. Scripting languages such as Python undeniably lead to faster development times (no compile cycle, less book keeping syntax to worry about) and as computers continue to get faster and cheaper the overhead associated with these languages becomes less and less important. Kevin’s concept of an application with an exposed object model that can be tweaked by the user is a powerful idea, and one that could bring real benefits; Python is not a difficult language to program in, and applications which can be scripted easily can become very popular (just look at the mIRC community for an example of that). Unfortunately the ability to script an application also leads to inherent security flaws, as have been seen with VBScript and Microsoft Office—although in the case of Office most of the problems stem from the ability to add macros to individual documents (there are surprisingly few mIRC security alerts despite the in built scripting engine).

This is PythonCard scriptlets by Simon Willison, posted on 27th October 2002.

Next: Shiny

Previous: Googlism

Previously hosted at http://simon.incutio.com/archive/2002/10/27/scriptletsAndPythonCard