Article View: adobe.scripting.indesign
Article #16803Re: Script to make a contact sheet?
From: Shane Stanley
Date: Wed, 30 Jul 2003 01:20
Date: Wed, 30 Jul 2003 01:20
49 lines
3198 bytes
3198 bytes
OK, we can simplify things with a template. Make a new doc, no facing pages, and go to the A Master page. Draw frames where you want the pics to go, and text frames for the captions. Now go to the Windows menu and choose Script Label, which brings up a palette that lets you label the frames.
With the selection tool, click on the first pic frame, then go to the Script Label palette and enter 1, followed by a return. Go to the second and enter 2, and so on. Do the same thing for the caption frames (again starting from 1). Save your finished template. (You probably also want to apply styling to the caption frames.)
Now for the easy part. Paste the following script into a window in Script Editor, and save it as an application. Because it contains an "on open" handler, it will become a droplet.
With the template open, go to the Finder, select a bunch of pictures, and drag-and-drop them as a batch over the script application. Bob's your uncle.
on open fileList -- contains list of pic files
set frameCounter to 1 -- counter to use to work through frame names
tell application "InDesign 2.0.2"
tell document 1
set theMaster to master spread 1 -- needed when adding pages later
get master page items of page -1 -- overrides items from master
-- loop through pics
repeat with aPic in fileList
-- get name of pic for caption
set oldDelims to AppleScript's text item delimiters
set AppleScript's text item delimiters to {":"}
set picName to text item -1 of (aPic as text)
set AppleScript's text item delimiters to oldDelims
try -- we try, in case there isn't a frame of the right label
place aPic on rectangle (frameCounter as text) of page -1
fit result given proportionally
set contents of text frame (frameCounter as text) of page -1 to picName
on error -- we've run out of frames on the page
set frameCounter to 1 -- reset counter
make page at end with properties {applied master:theMaster} -- add page
get master page items of page -1 -- override master items
place aPic on rectangle (frameCounter as text) of page -1
fit result given proportionally
set contents of text frame (frameCounter as text) of page -1 to picName
end try
set frameCounter to frameCounter + 1 -- increment counter
end repeat
end tell
end tell
end open
That should get you started.
Shane
Technical Details
Message-ID:
<1dea1a30.2@WebX.la2eafNXanI>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-04!sn-xit-06!sn-xit-05!sn-xit-09!supernews.com!news.maxwell.syr.edu!nntp.infostrada.it!newsfeed01.sul.t-online.de!t-online.de!WebXReferences:
<1dea1a30.-1@WebX.la2eafNXanI>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f939a,9a5ab23a310cf1ec X-Google-Attributes: gidf939a,public X-Google-ArrivalTime: 2003-07-29 18:38:04 PST From: "Shane Stanley" <sstanley@myriad-com.com.au> Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-04!sn-xit-06!sn-xit-05!sn-xit-09!supernews.com!news.maxwell.syr.edu!nntp.infostrada.it!newsfeed01.sul.t-online.de!t-online.de!WebX Newsgroups: adobe.scripting.indesign Subject: Re: Script to make a contact sheet? Message-ID: <1dea1a30.2@WebX.la2eafNXanI> Date: Tue, 29 Jul 2003 18:20:02 -0700 References: <1dea1a30.-1@WebX.la2eafNXanI> Lines: 60 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit