-- Dieter May , Sept 2010 --"Digi A4" property print_preset : "" --"AI-IND-X1-F39" property pdf_export_preset : "AI-IND-X1-F39" property save_indd_after_export : true --------------------------------------------------------------------------- to process_file(this_file) set file_info to info for this_file if name extension of file_info is "indd" then set new_file_name to (my remove_ext(name of file_info) as string) set parent_folder to (my get_parent_folder(this_file) as string) set pdf_file_path to (parent_folder & new_file_name & ".pdf" as string) try tell application "Adobe InDesign CS5" set user interaction level of script preferences to never interact open this_file tell active document if print_preset is not "" then print using print_preset without print dialog end if if pdf_export_preset is not "" then export format PDF type to pdf_file_path using pdf_export_preset without showing options end if if save_indd_after_export is true then close saving yes else close saving no end if end tell --close active document saving no set user interaction level of script preferences to interact with all end tell on error error_mess tell application "Adobe InDesign CS5" to set user interaction level of script preferences to interact with all display dialog error_mess --return end try end if end process_file on run set alias_list to choose folder with multiple selections allowed without invisibles repeat with i in alias_list process_unknown_item(i) end repeat end run on open alias_list repeat with i in alias_list process_unknown_item(i) end repeat end open to process_unknown_item(this_item) if (this_item as text) ends with ":" then process_folder(this_item) else process_file(this_item) end if end process_unknown_item to process_folder(this_folder) set itemList to list folder this_folder without invisibles repeat with i in itemList process_unknown_item(alias ((this_folder as text) & i)) end repeat end process_folder on remove_ext(this_item) set this_item to this_item as text set the_offset to offset of "." in (reverse of characters in this_item as text) if the_offset ­ 0 then set this_item to characters 1 thru -(the_offset + 1) of this_item as text return this_item end remove_ext on get_parent_folder(this_item) set this_item to this_item as text if this_item ends with ":" then set cc to count characters of this_item set this_item to characters 1 through (cc - 1) of this_item as string end if set n to every character of this_item as list set r to reverse of n set x to (offset of ":" in (r as string)) - 1 set cc to count characters of this_item set parent_folder to characters 1 through (cc - x) of this_item as string return parent_folder end get_parent_folder