|
|
|
|
#1 |
|
Sysop Emeritus
Join Date: Oct 2004
Posts: 76
|
It's nice to see so much activity in this section. I thought I'd contribute this AppleScript I've been using for the past couple of weeks in InDesign CS. It collects all the art in a folder and creates a new library, with each piece of art labeled and assigned the appropriate text runaround settings.
Before discussing what you might want to change in it for your own use, I want to thank Shane and Ray (and their AppleScripting Pro seminar) for their help in creating this. In the second line of the script, where theLibFolder is defined, I've chosen to pick up the second-to-last word of the art folder because that's what makes sense for this job. The folders were called "Snacks art" and "Sandwiches art" so I wanted to pick up the descriptive word for use in the library name. The section of the script that's labeled "-- add item label and text wrap settings" might also need to be customized, as I specifically wanted the text runaround of the images to use a contour wrap. I had already added clipping paths to the art, so with no docs open I set the runaround in InDesign to wrap three points from a Photoshop path, and that got picked up by the script (apparently). Let me know if you have any questions, and I'm sure Shane or Ray will be able to answer them. ;-) Brad (who hopes that wrapping the script in code tags is a smart move) -------- Code:
set theFolder to choose folder with prompt "Choose a folder of picture files:"
set theFolderPath to theFolder as Unicode text
set theLibFolder to word -2 of theFolderPath
set thefilenames to list folder theFolder without invisibles
set fileCount to count of thefilenames
tell application "InDesign CS"
activate
-- create and name library to selected folder name, create temp doc
set theLib to make library with data {full name:(theFolderPath & theLibFolder & " art library.indl")}
make document
tell document 1
-- create a page for each piece of art
tell document preferences
set pages per document to fileCount
end tell
end tell
-- loop through art placement, styling, and library addition
repeat with i from 1 to count of thefilenames
tell document 1
-- place the image
set thisImage to place (theFolderPath & (item i of thefilenames)) on page i
set thisLabel to (item i of thefilenames) as string
set thisBox to parent of thisImage
-- make its container fit
fit thisBox given frame to content
-- add item label and text wrap settings
set properties of thisBox to {label:thisLabel}
tell text wrap preferences of thisImage
set text wrap type to contour
end tell
-- store item in library
set storedItem to store theLib using page item 1 of page i
end tell
set libLabel to name of storedItem
place asset asset libLabel of theLib on document 1
end repeat
beep
with timeout of 10000 seconds
display dialog "Finished." buttons {"OK"} default button 1
end timeout
end tell
|
|
|
|
|
|
#2 |
|
Member
Join Date: Feb 2005
Location: Northwest Georgia, US
Posts: 11
|
Brad,
Nice job! Whenever I see an AS Pro alumnus use something like "word -2" it makes me very proud. <g> FYI, I had dinner Thursday with Chris Ryland and Mark Neimann-Ross. The DTP forum was discussed (which I will share elsewhere eventually), and they both asked about you. I'm glad to see you are finding AppleScript useful. Good work! Ray Robertson |
|
|
|
|
|
#3 |
|
Sysop Emeritus
Join Date: Oct 2004
Posts: 76
|
Thanks. This script has saved me a ton of time on this job. Today alone I used it to create three libraries comprising over 250 pieces of art, leaving me to just have to drag the images onto the pages and position them based on the layout.
To do the clipping paths, I set up an Action in Photoshop to use the magic wand, invert and expand the selection (since I used the enlarged path to knock out a rule that would need to look broken by the art), create the path, and save the file. And then I made a Droplet that would run the Action when I dragged files onto it in the Finder! If you talk to Chris and MNR again, let them know about the *new* DTP Forum. It looks like Kathleen, Elyse, and Ann (and the rest of the staff) have helped create a nice new home for us. Brad |
|
|
|
|
|
#4 | ||
|
Member
Join Date: Feb 2005
Location: Northwest Georgia, US
Posts: 11
|
Quote:
Quote:
Ray |
||
|
|
|
|
|
#5 | ||
|
Sysop Emeritus
Join Date: Oct 2004
Posts: 76
|
Quote:
I'm starting an eight-book series in InDesign next month, and now I'm itching to find some excuse to script parts of it. Quote:
Brad |
||
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| FontAgentPro: export/import libraries? | donat | Fonts & Typography | 13 | 02-28-2008 06:49 AM |
| [PR] Secure Powerpoint: create value from content | Phil | General Publishing Topics | 3 | 02-17-2007 09:09 AM |
| indesign script | yamisabel | Print Production & Automation | 2 | 01-26-2007 11:10 AM |
| PageMaker7.0 fails to create PDF | Barbara | Print Production & Automation | 30 | 11-18-2006 09:52 AM |
| Create a round JPG? | jwoolf09 | Images | 4 | 10-17-2006 12:14 PM |