Hello all
Somehow this script does not work properly in OSX , does anyone know about a script that will put images from source folder and put them on indesign pages?
Thanks
R
set myReverseOrder to true
–Set page height, page width
set myPageWidth to 115
set myPageHeight to 180
–Display a “Choose Folder” dialog box.
set myFolder to choose folder with prompt “Select the folder containing the files you want to place.”
tell application “Finder”
set myFiles to (every file of folder myFolder whose file type is “IDd3”) as alias list
set myNumberOfPages to (count myFiles)
–The sort method is not yet available for the OSX Finder.
– Make sure that the files in the folder
–are sorted in the order in which you want them to appear.
–Uncomment this line if you’re using OS 9.
–set myFiles to sort files of myFolder by name
end tell
tell application “InDesign CS”
set myDocument to active document
if myReverseOrder is true then
set myPageNumber to myNumberOfPages
set myPageIncrement to -1
else
set myPageNumber to 1
set myPageIncrement to 1
end if
-- make a layer whose name is Image layer
tell myDocument
try
set ImageLayer to layer "Image layer" of myDocument
on error
set ImageLayer to make layer with properties {visible:true, locked:false, name:"Image layer"}
end try
end tell
repeat with myCounter from 1 to myNumberOfPages
set myFileName to item myCounter of myFiles as string
set myPage to page myPageNumber of myDocument
tell myPage
-- place the image on the "Image layer"
set myRectangle to make rectangle with properties {geometric bounds:{0, 0, myPageHeight, myPageWidth}, item layer:layer "Image layer"}
tell myRectangle
place myFileName
end tell
fit myRectangle given content to frame
fit myRectangle given proportionally
end tell
set myPageNumber to myPageNumber + myPageIncrement
end repeat
end tell