DTP


 
Lively discussions on the graphic arts and publishing — in print or on the web


Go Back   Desktop Publishing Forum > General Discussions > Print Production & Automation

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Old 02-12-2005, 01:46 PM   #1
BradW
Sysop Emeritus
 
Join Date: Oct 2004
Posts: 76
Default Script to create InDesign libraries

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
BradW is offline   Reply With Quote
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

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


All times are GMT -8. The time now is 08:21 PM.


Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Contents copyright 2004–2014 Desktop Publishing Forum and its members.