InDesign tip : #04

if you’re using InDesign and you’re NOT using at least one library, you’re probably a loony. a library stores all your most commonly used stuff : logos, images, graphics, even text. you could think of a library as a type of permanent clipboard. a clipboard will only hold the last thing you copied, a library will hold as much stuff as you want.

a library is dead easy to set up and even easier to use. it looks like a panel, but it’s actually a file :
go to File > New > Library …
choose a name and a place to save it
then just drag stuff into it from your InDesign page

library screen grab 1

you’ll notice that when you drag an image in, it will be named automatically. everything else comes in as ‘untitled’. name your other bits by double-clicking on them to access the item info panel :

library screen grab 2

library objects also retain their styling so it’s also a great way to store swatches, styles (paragraph, character and object) and effects such as dropshadows and whatnot.

library screen grab 5

now whenever you need something just drag it out onto your page. if you have ‘paste remembers layers’ turned on in your layers palette, the object will even be pasted on the correct layer (ie. the layer it was on before it was added to the library).

but wait, there’s more…
if you drag a bunch of stuff into the library in one hit it will be grouped into one library item :

library screen grab 3

but if you want to add a heap of objects as separate items just add them all to a single page and then choose this from the panel’s dropdown menu :

library screen grab 4

there’s no limit to the number of different libraries you can have — go sick. although you may find that anything more than about 25 may become a little difficult to manage.

macgrunt icon

InDesign scripting : lesson 03

one more thing needs to be explained about the script from lesson 02 before we move on to gruntier things. here’s the script again, notice the line ‘tell active document’ :

surely it’s obvious, when there’s only one document open, that the document is active. why can’t we just write ‘tell document’? who knows, it’s just the way it is, so you’ll have to get over it.

there’s a bunch of different ways to address InDesign documents, depending on what you’re trying to do. here’s one other way to address the active (frontmost) document :

tell document 1

here’s how you’d bring the second document (the one behind the active document) to the front :

set active document to document 2

that’s pretty handy if you only need to swap the active document once or twice, but as you get more adventurous you’ll be wanting to swap between more than two open documents, or swap backwards and forwards a lot, and it becomes virtually impossible to keep track of which document is active at any given point in your script.

that’s when you need variables. a variable is a ‘container’ to store stuff in so you can keep track of it and access it easily throughout your script. it is basically just a name you assign so that you can refer to your stuff in shorthand. an example might help to explain it better. in the calendars example, the calendar template is named “CodeNo_Calendar Title_C.indd”. here’s the long-winded way to work with that document :

set active document to every document whose name is "CodeNo_Calendar Title_C.indd"
tell active document
  --do some interesting stuff
end tell

but, if early in the script we assign the document to a variable …

set mgTemplate to every document whose name contains "CodeNo"

… we can from then on refer to it in shorthand :

set active document to mgTemplate
tell mgTemplate
  --do some interesting stuff
end tell

you can use anything you like as your variable name, as long as it doesn’t conflict with any of applescript’s recognised terms or commands. scripter’s will often use things like ‘myTemplate’, my_template’ or ‘theTemplate’ — whatever suits your style.

you can easily identify variables in script editor — as they are given a unique colour when the script is compiled:

script editor screen grab

macgrunt icon

get file path of finder items

here’s a handy trick based on an original post you can find here at Macworld.

There may be times—such as when you’re trying to convey to someone where a file can be found on their machine, or maybe when you’re writing an OS X hints column—when you need to put the path to some file or folder into another document. — Rob Griffiths,

Applescript Iconthe original script does something very simple — a basic task which is missing from OS X — copying the filepath of a selected finder item into a text format. the original script looks like this :

running this script will place text on your clipboard — ready to paste into an email or whatever. the text would look something like this :
this shows that ‘Script Editor’ can be found in the folder ‘Applescript’ which is in the folder ‘Applications’ — a slash delimited filepath.

you may prefer the more common colon delimited filepath which also shows the home volume — MacGrunt:Applications:AppleScript:Script
if so, you’d replace those two lines in the middle with this :

set the clipboard to the selection as text

but here’s another variation which does two additional things :
allows for copying filepaths for multiple items
changes the output to an arrow delimited format

results look more like this :
MacGrunt > Applications > AppleScript > Script
MacGrunt > Users > macgrunt > Desktop > Picture 1.png

you can download CopyPath as a finished script here.

now for the cool bit …

Automator Iconhaving to launch an app every time you want to copy a filepath would be a right pain. but you can turn this script into a contextual menu item with automator. here’s how.

prior to OS X 10.6 (Snow Leopard) :
open automator and search for the action “Run Applescript”
drag this action into your workspace
replace the default script with the downloaded one :

then choose File > Save As Plug-in… :

now whenever you want to copy a filepath to your clipboard, simply right-click (or control-click) on the file/s and navigate to the bottom of the contextual menu, like so :

slightly different for OS X 10.6 (Snow Leopard) :
automator changed in 10.6 to include the ‘Service’ option. using this option you’ll see the top of the workspace looks more like this (click to enlarge) :

set the service to allow input from files and folders in the finder.

and for Lion users … :
you guys are so advanced, you’re sure to work it out yourselves.

you’re bound to find many other uses for this handy feature of automator.
have fun.

macgrunt icon

InDesign tip : #03

you probably already know that you can target your find/change routines by specifying a paragraph style and/or character style. that is, for example, you can search only your captions by restricting the find format to your caption paragraph style.

and if you know that, you probably also know that you can restrict your search by any text formatting parameter : only 10pt text; only Arial text; only underlined text coloured purple; whatever.

but here’s another find/change trick you may not be aware of … handy for documents that have become hideously misshapen by lots of unnecessary style overrides (not one of your own documents, obviously — one that has been messed up by someone else).

you can use find/change to quickly clear style overrides if you leave the ‘find what’ and ‘change to’ fields blank and set the ‘find format’ and ‘change format’ fields to the same paragraph style or character style. hit change all and any overrides for that style will be wiped out. or, if you’re feeling a bit cautious, you can of course find/change each instance individually.

and you can do the same thing with object styles (after CS2).

macgrunt icon

video 02 : calendars

macgrunt is all about workflow optimisation, with an emphasis on automation, particularly applescript. some people may think “oh, I’m a Designer, you can’t automate design.” — which is absolutely correct. but there are many many tasks in a studio which are NOT design. and if you can get those done and out of the way quickly, it gives you more time to do the creative stuff.

imagine you have to take all the content from a sales flyer and copy it into a designed calendar template, scale and place all the elements throughout, then duplicate those elements to the back cover, update the colour, add the product code and barcode, and save the new file with the correct filename in the correct folder. got that? ok, now imagine you have to do that for over 60 calendars — every year.

calendars is a quick animation which shows an actual script performing a real-life task in a fraction of the time it would take a real-life human. the animation is built from screen grabs from the actual workflow — so those dialog boxes showing how long the script took to do each job are real and accurate (testing was done with CS2 on a G5 PowerPC running OSX 10.5.7).

if that doesn’t convince you to start learning, stay tuned, more to follow.

macgrunt icon