InDesign scripting : lesson 26

you learn something new every day — well, at least you should, if you’re paying sufficient attention.

way back in lesson 04 you’ll find this statement :

the first scripting lesson – lesson 01 – suggested you save your InDesign applescripts in script file format (.scpt). but there’s a very good reason why you should ignore such nonsensical advice and save them in text file format (.applescript) instead…

well, it turns out that there’s also a very good reason to ignore THAT and go on and save your scripts in .scpt format — the marvellous script property.

a script property is an immensely handy little scripting trick. it allows you to save data into a variable, within the script, so that it is still available the next time the script is run, and the next time. The data is persistent.

one example of the use of a script property is in the finder cleanup app. on the first run, this script captures the way finder windows are set so that, the next time the script is run, and every time after, those same finder windows can be opened in exactly the same place and pointing to exactly the same folders. so, the data is captured, then used over and over again.

but, if your InDesign script is saved in text format (.applescript) the data captured in the script property is not persistent. it works fine while the script is running, but the data is lost once the script ends and has to be reinstated the next time the script is run.

so, if you’re going to take advantage of a persistent script property you need to save your work in the .scpt format.

the next scripting lesson will show how a script property is used in a variation of the slug form script from lesson 25.

macgrunt icon

Advertisements

thoughtful and respectful comments welcome

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s