Hi All
Can any one have Cataloging Script for InDesign CS2.
Thanks
Rajeev
Hi All
Can any one have Cataloging Script for InDesign CS2.
Thanks
Rajeev
I found this script a while back, it was built fir Indesign and don’t see why it wouldn’t work for 2
it has alot of nice features
global myFolder
set oldHViewPrefs to ""
set oldVViewPrefs to ""
set myExtensions to {"tif", "tiff", "jpg", "jpeg", "gif", "eps", "ps", "psd", "ai", "pdf"}
set myFileList to {}
set myFolder to choose folder with prompt "Select the folder containing the graphics you want to place"
tell application "Finder"
set sortedFiles to {}
set myFiles to list folder myFolder without invisibles
repeat with myFile in myFiles
set temp to properties of ((myFolder as string) & myFile as alias)
if class of temp is document file then
set sortedFiles to sortedFiles & myFile
end if
end repeat
set myFiles to sortedFiles
end tell
repeat with myCounter from 1 to count of items in myFiles
set myFile to item myCounter of myFiles
try
tell application "Finder"
set myFileType to file type of (((myFolder as string) & myFile) as alias) --myFile
end tell
end try
set myFileTypes to {"JPEG", "EPSF", "PICT", "TIFF", "8BPs", "GIFf", "PDF "}
if myFileTypes contains myFileType then
copy myFile to end of myFileList
else if myFileType is missing value or myFileType is "TEXT" then
set oldTID to AppleScript's text item delimiters
set AppleScript's text item delimiters to "."
set currentExt to text item -1 of myFile
if myExtensions contains currentExt then
copy myFile to end of myFileList
--exit repeat
end if
set AppleScript's text item delimiters to oldTID
end if
end repeat
if (count myFileList) > 0 then
myDisplayDialog(myFileList, myFolder)
display dialog "Done!"
else if (count myFileList) = 0 then
display dialog "No valid files found"
end if
--show the dialog
on myDisplayDialog(myFiles, myFolder)
set myLabelWidth to 132
tell application "InDesign CS"
set myDialog to make dialog with properties {name:"ImageCatalog"}
tell myDialog
tell (make dialog column)
tell (make dialog row)
make static text with properties {static label:"Information"}
end tell
tell (make border panel)
tell (make dialog column)
tell (make dialog row)
make static text with properties {static label:"SourceFolder:", min width:myLabelWidth}
make static text with properties {static label:myFolder, min width:myLabelWidth}
end tell
tell (make dialog row)
make static text with properties {static label:"Number of Graphics:", min width:myLabelWidth}
make static text with properties {static label:((count myFiles) as string)}
end tell
end tell
end tell
tell (make dialog row)
make static text with properties {static label:"Options"}
end tell
tell (make border panel)
tell (make dialog column)
tell (make dialog row)
make static text with properties {static label:"Number of Rows:", min width:myLabelWidth}
set myNumberOfRowsField to make integer editbox with properties {edit value:3}
end tell
tell (make dialog row)
make static text with properties {static label:"Number of Columns:", min width:myLabelWidth}
set myNumberOfColumnsField to make integer editbox with properties {edit value:3}
end tell
tell (make dialog row)
make static text with properties {static label:"Vertical Offset:", min width:myLabelWidth}
set myVerticalOffsetField to make measurement editbox with properties {edit value:12, edit units:points}
end tell
tell (make dialog row)
make static text with properties {static label:"Horizontal Offset:", min width:myLabelWidth}
set myHorizontalOffsetField to make measurement editbox with properties {edit value:12, edit units:points}
end tell
tell (make dialog row)
tell (make dialog column)
make static text with properties {static label:"Page Size:", min width:myLabelWidth}
end tell
tell (make dialog column)
set myPageSizeButtons to make radiobutton group
tell myPageSizeButtons
make radiobutton control with properties {static label:"Letter Portrait", checked state:true}
make radiobutton control with properties {static label:"Letter Landscape", checked state:false}
make radiobutton control with properties {static label:"Tabloid Portrait", checked state:false}
make radiobutton control with properties {static label:"Tabloid Landscape", checked state:false}
make radiobutton control with properties {static label:"A4 Portrait", checked state:false}
make radiobutton control with properties {static label:"A4 Landscape", checked state:false}
end tell
end tell
end tell
tell (make dialog row)
tell (make dialog column)
make static text with properties {static label:"Label:", min width:myLabelWidth}
end tell
tell (make dialog column)
set myLabelsButtons to make radiobutton group
tell myLabelsButtons
make radiobutton control with properties {static label:"None", checked state:true}
make radiobutton control with properties {static label:"File Name", checked state:false}
make radiobutton control with properties {static label:"File Name and Image Info", checked state:false}
make radiobutton control with properties {static label:"Full Path", checked state:false}
end tell
end tell
end tell
tell (make dialog row)
tell (make dialog column)
make static text with properties {static label:"Fitting:", min width:myLabelWidth}
end tell
tell (make dialog column)
set myFitProportionalCheckbox to make checkbox control with properties {static label:"Proportional", checked state:true}
set myFitCenterContentCheckbox to make checkbox control with properties {static label:"Center Content", checked state:true}
set myFitFrameToContentCheckbox to make checkbox control with properties {static label:"FrameToContent", checked state:true}
end tell
end tell
tell (make dialog row)
set myRemoveEmptyFramesCheckbox to make checkbox control with properties {static label:"Remove Empty Frames", checked state:true}
end tell
end tell
end tell
end tell
end tell
set myResult to show myDialog
if myResult = true then
set myNumberOfRows to edit value of myNumberOfRowsField
set myNumberOfColumns to edit value of myNumberOfColumnsField
set myVerticalOffset to edit value of myVerticalOffsetField
set myHorizontalOffset to edit value of myHorizontalOffsetField
set myPageSize to selected button of myPageSizeButtons
set myLabels to selected button of myLabelsButtons
set myFitProportional to checked state of myFitProportionalCheckbox
set myFitCenterContent to checked state of myFitCenterContentCheckbox
set myFitFrameToContent to checked state of myFitFrameToContentCheckbox
set myRemoveEmptyFrames to checked state of myRemoveEmptyFramesCheckbox
my myMakeImageCatalog(myFiles, myNumberOfRows, myNumberOfColumns, myPageSize, myLabels, myRemoveEmptyFrames, myVerticalOffset, myHorizontalOffset, myFitProportional, myFitCenterContent, myFitFrameToContent)
end if
destroy myDialog
end tell
end myDisplayDialog
on myMakeImageCatalog(myFiles, myNumberOfRows, myNumberOfColumns, myPageSize, myLabels, myRemoveEmptyFrames, myVerticalOffset, myHorizontalOffset, myFitProportional, myFitCenterContent, myFitFrameToContent)
tell application "InDesign CS"
set myFramesPerPage to myNumberOfRows * myNumberOfColumns
set myDocument to make document
set oldVViewPrefs to vertical measurement units of view preferences of myDocument
set oldHViewPrefs to horizontal measurement units of view preferences of myDocument
if myPageSize is less than 4 then
set horizontal measurement units of view preferences of myDocument to points
set vertical measurement units of view preferences of myDocument to points
else if myPageSize is greater than 3 then
set horizontal measurement units of view preferences of myDocument to millimeters
set vertical measurement units of view preferences of myDocument to millimeters
end if
if myPageSize is 0 then
set properties of document preferences of myDocument to {page width:612, page height:792}
else if myPageSize is 1 then
set properties of document preferences of myDocument to {page width:792, page height:612}
else if myPageSize is 2 then
set properties of document preferences of myDocument to {page width:792, page height:1224}
else if myPageSize is 3 then
set properties of document preferences of myDocument to {page width:1224, page height:792}
else if myPageSize is 4 then
set properties of document preferences of myDocument to {page width:210, page height:297}
else if myPageSize is 5 then
set properties of document preferences of myDocument to {page width:297, page height:210}
end if
set myDocumentPreferences to document preferences of myDocument
set myNumberOfFrames to (count myFiles)
set myNumberOfPages to ((myNumberOfFrames / myFramesPerPage) as string)
if ((myNumberOfPages * myFramesPerPage) < myNumberOfFrames) then
set myNumberOfPages to myNumberOfPages + 1
end if
set myNumberOfPages to round myNumberOfPages
set pages per document of myDocumentPreferences to myNumberOfPages
set facing pages of myDocumentPreferences to false
set myPage to page 1 of myDocument
set myMarginPreferences to margin preferences of myPage
set myLeftMargin to left of myMarginPreferences
set myTopMargin to top of myMarginPreferences
set myRightMargin to right of myMarginPreferences
set myBottomMargin to bottom of myMarginPreferences
set myLiveWidth to ((page width of myDocumentPreferences) - (myLeftMargin + myRightMargin)) + myHorizontalOffset
set myLiveHeight to (page height of myDocumentPreferences) - (myTopMargin + myBottomMargin)
set myColumnWidth to myLiveWidth / myNumberOfColumns
set myFrameWidth to myColumnWidth - myHorizontalOffset
set myRowHeight to (myLiveHeight / myNumberOfRows)
set myFrameHeight to myRowHeight - myVerticalOffset
if myLabels is not equal to 0 then
try
set myLabelStyle to paragraph style "Labels" of myDocument
on error
tell myDocument
set myLabelStyle to make new paragraph style with properties {name:"Labels", point size:8}
end tell
end try
try
set myLabelLayer to layer "Labels" of myDocument
on error
tell myDocument
set myLabelLayer to make layer with properties {name:"Labels"}
end tell
end try
end if
repeat with myCounter from (count pages of myDocument) to 1 by -1
set myPage to page myCounter of myDocument
repeat with myRowCounter from (myNumberOfRows - 1) to 0 by -1
set myY1 to myTopMargin + (myRowHeight * myRowCounter)
set myY2 to myY1 + myFrameHeight
repeat with myColumnCounter from (myNumberOfColumns - 1) to 0 by -1
set myX1 to myLeftMargin + (myColumnWidth * myColumnCounter)
set myX2 to myX1 + myFrameWidth
tell myPage to make rectangle with properties {geometric bounds:{myY1, myX1, myY2, myX2}, stroke weight:0, stroke color:swatch "None" of myDocument, item layer:layer -1 of myDocument}
end repeat
end repeat
end repeat
repeat with myCounter from 1 to myNumberOfFrames
set myFile to item myCounter of myFiles
set myRectangle to rectangle myCounter of myDocument
tell myRectangle
set temp to place (((myFolder as string) & myFile) as alias)
try
set myFilePPI to actual ppi of temp
end try
set geoBounds to (geometric bounds of (properties of (object reference of temp)))
set label to myFile as string
if myFitProportional is true then
fit given proportionally
end if
if myFitCenterContent is true then
fit given center content
end if
if myFitFrameToContent is true then
fit given frame to content
end if
end tell
if myLabels is not equal to 0 then
if myLabels is 1 then
set myLabelString to myFile
else if myLabels is 2 then
try
set myWidth to (((item 4 of geoBounds) - (item 2 of geoBounds)) / 72) * 1000
set myHeight to (((item 3 of geoBounds) - (item 1 of geoBounds)) / 72) * 1000
set myWidth to (round myWidth) / 1000
set myHeight to (round myHeight) / 1000
set myLabelString to (myFile & " is " & myWidth & " inches x " & myHeight & " inches @ " & (item 1 of myFilePPI) & " ppi") as string
on error
set myLabelString to (myFile & " (resolution info missing)") as string
end try
else if myLabels is 3 then
set myLabelString to ((myFolder as string) & myFile) as string
end if
set myX1 to item 2 of geometric bounds of myRectangle
set myBounds to geometric bounds of myRectangle
set myY1 to item 3 of myBounds
set myX2 to item 4 of myBounds
set myY2 to (item 3 of myBounds) + myVerticalOffset
tell parent of myRectangle
set myTextFrame to make text frame with properties {geometric bounds:{myY1, myX1, myY2, myX2}, contents:myLabelString, item layer:myLabelLayer}
tell myTextFrame
set first baseline offset of text frame preferences to leading offset
set applied paragraph style of text 1 to myLabelStyle
end tell
end tell
end if
end repeat
if myRemoveEmptyFrames is true then
try
tell myDocument
tell (every rectangle whose content type is unassigned) to delete
end tell
end try
end if
tell myDocument
set horizontal measurement units of view preferences of myDocument to oldHViewPrefs
set vertical measurement units of view preferences of myDocument to oldVViewPrefs
end tell
end tell
end myMakeImageCatalog