InDesign scripting : lesson 07

here’s a simple one-lesson script before we start on a series of lessons about exporting PDFs. sometimes it’s handy to be able to toggle between different preference settings: measurement units; dictionaries; keyboard increments; or, in this case, vector display. most of the time it’s better to display vector images as high res, because the proxy vector preview is truly atrocious. but your screen redraw time gets really bogged down for files which have too many vector images — so then it’s better to set it back to proxy. here’s a basic if/then script to toggle between the two preferences :

tell application "Adobe InDesign CS4"
    if (vector of display settings) contains proxy then
        set properties of display settings to {vector:high resolution}
    else
        set properties of display settings to {vector:proxy}
    end if
end tell

this is the simplest form of toggle — two possible states, check which one is current then switch to the other.

the real purpose of this lesson is to have another look at the InDesign applescript dictionary first discussed in lesson 02. this is an example of how sometimes it may take a little digging around to find the exact terminology you’re looking for.

if you have a look at your InDesign preferences you’ll find that the vector view settings are managed from the ‘display performance’ window :

screen grab of display performance preferences window

that seems like a logical place to start searching the dictionary. but if you search for “display performance” you’ll get something like this :

screen grab of display performance entry in applescript library

… not very helpful. no mention at all of how to display vector images. bugger. InDesign has excellent applescript support. that is, there aren’t too many InDesign commands that can’t be performed through scripting. BUT the documentation — the dictionary — could be structured a leetle bit more closely to the user interface.

anyway, that’s just the way it is — so, maybe try “vector” :

screen grab of vector entry in applescript library

… ah, that’s better. here we can see an entry for “vector” as a property belonging to the “preferences suite”. and this is where we find out that if we want to change how vector art is previewed, we have to address display settings, not display performance.

luckily, this was an easy one. it’s not always so straightforward. but always remember, when things get difficult, google is your friend.

ok. now for your homework. how would you alter the script so that it toggles between all three vector display options?

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