Article View: adobe.scripting.indesign
Article #16727Re: Script to make a contact sheet?
From: CouponBoy
Date: Tue, 05 Aug 2003 16:08
Date: Tue, 05 Aug 2003 16:08
105 lines
7143 bytes
7143 bytes
guys, Olav Kvern made this one up and I twaeked it up nice. Will put all images in a catalog page and you can specify the number of images per page. It won't do sub folders, so you have to have the ones you want out in 1 folder, but after that just sit back and relax. Check your system to see if you have helvetica condensed font, i think I used that in here for the image labels. you can change it if you need to. Also put this in the ID> scripts folder and run it from the pallet.
email me if you need help,
chris
chris.paveglio@clippermagazine.com
UGH entire script too big for 1 post, here is the first part!
-----
--PlaceAllFilesWithFileName
--This script attempts to place all files found in a specified folder and adds a label
--to each frame containing the file name only (is possible to add full path to image).
set myFolder to choose folder with prompt "Select the folder containing the files you want to place."
tell application "Finder"
--get files in a folder, alphabetically, and of only ID-compatible and specified types
set myFiles to (sort (files of myFolder whose file type is �
"TIFF" or file type is �
"PDF " or file type is �
"8BPS" or file type is �
"JPEG" or file type is �
"EPSF" or creator type is �
"ART5") by name) as list
--file types that ID can't handle: PCDI-photo cd, TPIC-targa, RAW,
--adding "TEXT" file types will screw up the naming of boxes royally
--adding creator "ogle" Picture Viewer can be hazardous, PV handles many non printing file types
--The following line used to work in Mac OS 9.x, but doesn't seem to in OS 10.1.5/AppleScript 1.8.3
--set myFiles to sort files of myFolder by name
set myNumberOfFrames to (count of items of myFiles)
end tell
display dialog (myNumberOfFrames as string) & " files were found to place." with icon 1
--Set up the page layout by entering the number of rows and columns you want.
display dialog "How many rows down do you need?" default answer "4" with icon 1
set myNumberOfRows to (text returned of result) as number
display dialog "How many columns across do you need?" default answer "4" with icon 1
set myNumberOfColumns to (text returned of result) as number
--If you don't want to remove empty frames, set myRemoveEmptyFrames to false.
set myRemoveEmptyFrames to true
display dialog "Do you want to keep extra unfilled boxes or delete them?" buttons {"Keep", "Delete"} with icon 1 default button 2
if button returned of result is "Keep" then set myRemoveEmptyFrames to false
--ask for the title box on top
display dialog "What title do you want on the top of the page?" with icon 1 default answer "Catalog"
set myTitle to text returned of result
--myOffset defines the height of the text frame for the labels.
set myOffset to 18
set myFramesPerPage to (myNumberOfRows * myNumberOfColumns)
tell application "InDesign 2.0.2"
activate
set myDocument to make document
tell document 1 --tell doc 1 or else this stuff sets app prefs!
--Set the measurement units to points if they're not already set to points.
set horizontal measurement units of view preferences to points
set vertical measurement units of view preferences to points
--Create a paragraph style for the label and other text
set myParagraphStyle to make paragraph style with properties {name:"Label", point size:12, applied font:"Helvetica Neue", font style:"86 Heavy Italic", horizontal scale:75}
set myParagraphStyle2 to make paragraph style with properties {name:"Header", point size:18, applied font:"Helvetica Neue", font style:"86 Heavy Italic", fill color:swatch "Paper"}
set myParagraphStyle2 to make paragraph style with properties {name:"PageNum", point size:9, applied font:"Helvetica Neue", font style:"86 Heavy Italic", fill color:swatch "Paper", justification:right}
set myDocumentPreferences to document preferences of myDocument
set myNumberOfPages to round (myNumberOfFrames / myFramesPerPage) rounding up
set pages per spread of myDocumentPreferences to 1
set pages per document of myDocumentPreferences to myNumberOfPages
tell margin preferences of every page
set margin top to "6p"
set margin bottom to "3p"
set margin left to "3p"
set margin right to "3p"
end tell
set myMarginPreferences to margin preferences of page 1 of myDocument
set myLeftMargin to margin left of myMarginPreferences
set myRightMargin to margin right of myMarginPreferences
set myTopMargin to margin top of myMarginPreferences
set myBottomMargin to margin bottom of myMarginPreferences
--above lines need to stay to set up variables for other steps
set myLiveWidth to (page width of myDocumentPreferences) - (myLeftMargin + myRightMargin)
set myLiveHeight to (page height of myDocumentPreferences) - (myTopMargin + myBottomMargin)
set myFrameWidth to (myLiveWidth / myNumberOfColumns)
set myFrameHeight to (myLiveHeight / myNumberOfRows)
set myPages to pages of myDocument
set inset spacing of text frame preferences of myDocument to "3pt"
end tell
repeat with myCounter from (count myPages) to 1 by -1
set myPage to item myCounter of myPages
repeat with myRowCounter from myNumberOfRows to 1 by -1
set myY1 to myTopMargin + (myFrameHeight * (myRowCounter - 1))
set myY2 to myTopMargin + (myFrameHeight * myRowCounter) - 6 --6 is point space between boxes
repeat with myColumnCounter from myNumberOfColumns to 1 by -1
set myX1 to myLeftMargin + (myFrameWidth * (myColumnCounter - 1))
set myX2 to myLeftMargin + (myFrameWidth * myColumnCounter) - 6
tell myPage
set myBox to make rectangle with properties {geometric bounds:{myY1, myX1, myY2 - myOffset + 1, myX2}}
--subtract myOffset to make box not overlap text box, add +1pt to make box frames overlap and look consistent
set myText to make text frame with properties {geometric bounds:{myY2 - myOffset, myX1, myY2, myX2}}
end tell
--setting this outside of the rest of the make box statement seems extremely fucked up!, including in "Properties" doesnt work for some reason
set stroke weight of myBox to "1"
set stroke color of myBox to swatch "Black" of document 1
set stroke weight of myText to "1"
set stroke color of myText to swatch "Black" of document 1
end repeat
end repeat
end repeat
Technical Details
Message-ID:
<1dea1a30.27@WebX.la2eafNXanI>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-04!sn-xit-06!sn-xit-08!supernews.com!news.tele.dk!news.tele.dk!small.news.tele.dk!npeer.de.kpn-eurorings.net!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!WebXReferences:
<1dea1a30.-1@WebX.la2eafNXanI>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII X-Google-Thread: f939a,9a5ab23a310cf1ec X-Google-Attributes: gidf939a,public X-Google-ArrivalTime: 2003-08-05 09:38:33 PST From: CouponBoy <chris.paveglio@clippermagazine.com> Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-04!sn-xit-06!sn-xit-08!supernews.com!news.tele.dk!news.tele.dk!small.news.tele.dk!npeer.de.kpn-eurorings.net!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!WebX Newsgroups: adobe.scripting.indesign Subject: Re: Script to make a contact sheet? Message-ID: <1dea1a30.27@WebX.la2eafNXanI> Date: Tue, 5 Aug 2003 09:08:17 -0700 References: <1dea1a30.-1@WebX.la2eafNXanI> Lines: 141 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit