set the_files to (my get_folder_list((choose folder with prompt “Locate your image source folder”), {“JPEG”, “TIFF”, "PDF ", “EPSF”}, {“jpg”, “tif”, “pdf”, “eps”}, false, false))
tell application “InDesign 2.0.2”
activate
set old_pps to pages per spread of document preferences
set pages per spread of document preferences to 1
set doc_ref to make new document at beginning
set pages per spread of document preferences to old_pps
tell doc_ref
set properties of view preferences to {horizontal measurement units:points, vertical measurement units:points}
copy {(bounds of page 1), 1, 12, 36, 36, 36, 0} to {{x1, y1, page_height, page_width}, the_page, the_offset, x, y, the_margin, largest_width}
repeat with the_file in the_files
set active spread of window 1 to parent of page the_page
tell page the_page
set the_image to place (the_file as alias)
set image_box to parent of the_image
copy geometric bounds of the_image to {y1, x1, y2, x2}
copy {(x + x2), (y + y2)} to {x2, y2}
set geometric bounds of the_image to {y, x, y2, x2}
set geometric bounds of image_box to {y, x, y2, x2}
if x2 > largest_width then set largest_width to x2
set y to y2 + the_offset
if y > (page_height - (the_margin * 2)) then copy {(largest_width + the_offset), 36, 0} to {x, y, largest_width}
end tell
if x > (page_width - (the_margin * 2)) then
copy {(the_page + 1), 36, 36, 0} to {the_page, x, y, largest_width}
make new page at end
end if
end repeat
end tell
beep 2
display dialog “All done.” buttons {“OK”} default button 1 with icon 1 giving up after 10
end tell
on get_folder_list(the_folder, file_types, file_extensions, with_subfolders, inc_folders)
set the_files to {}
tell application “Finder” to set folder_list to every item of folder the_folder
repeat with new_file in folder_list
if (new_file as string) ends with “:” then
if inc_folders = true then copy (new_file as string) to end of the_files
if with_subfolders = true then set the_files to the_files & (my get_folder_list((new_file as string), file_types, file_extensions, with_subfolders, inc_folders))
else
tell application “Finder” to set the_extension to name extension of new_file
if (file_types = {}) or (file_types contains (file type of new_file)) or (file_extensions contains the_extension) then copy (new_file as string) to end of the_files
end if
end repeat
return the_files
end get_folder_list
–this script was automatically tagged for
–color coded syntax by Script to Markup Code