Friday, August 26, 2005

 

Master of the Universes

Perhaps I've been watching too much Stargate, but it occurred to me that one way of explaining what scripting is all about is to think of your script as being master of three parallel universes:
Each of these is populated with objects with familiar names that you can probably relate to from your experience working with computers. In the JavaScript universe there are strings, numbers and arrays as well as some specialized objects like the Math object and dates. The InDesign universe is populated by the application itself (so you can address application-level entities like preferences), with documents, libraries, books, windows, and so on. The File System universe has files and folders.

These objects behave in just the ways you would expect based on your experiences dealing with them in your hands on use of them through the user interface. The difference for the scripter is that your script (I'm going to say "you" from here one) can deal with these elements directly rather than through the intermediary of the user interface.

Scripts are Not Macros

Some "scripting" languages are little more than user interface commands strung together. But this is not the case with scripts that drive InDesign. Indeed, there are cases where the behavior of the user interface can confuse a scripter:

That'll do for now. It's time for me to go watch some more Stargate!

Comments: Post a Comment

<< Home

This page is powered by Blogger. Isn't yours?