Hi everyone,
When working with Indesign CS2 you sometimes have to save your Document with “Save as” otherwise these Documents will grow permanently in file size since ID CS2 doesn’t clean up its own files very well.
Instead of opening and “saving as” hundrets of documents on our server i decided to write an applescript for that. So far - so good.
My only problem ist that my skript crashes Indesign if the Document is very large (more than 20 MB). Smaller files are no problem…
Here is my Script:
property type_list : {"indd"}
property extension_list : {"indd"}
on run
display dialog "Save Indesign Documents again for smaller file-sizes" buttons {"OK"} default button 1 with icon (path to resource "dockling.icns" in bundle ((path to library folder from system domain as string) & "CoreServices:dock.app") as alias)
end run
on open these_items
tell application "Adobe InDesign CS2"
set user interaction level of script preferences to never interact
end tell
repeat with i from 1 to the count of these_items
set this_item to (item i of these_items)
set the item_info to info for this_item
if folder of the item_info is true then
process_folder(this_item)
else if (alias of the item_info is false) then
process_item(this_item)
end if
end repeat
tell application "Adobe InDesign CS2"
set user interaction level of script preferences to interact with all
end tell
activate
display dialog "All Files have been saved." buttons {"OK"} default button 1 with icon (path to resource "AlertNoteIcon.icns" in bundle ((path to library folder from system domain as string) & "CoreServices:CoreTypes.bundle") as alias)
end open
on process_folder(this_folder)
set these_items to list folder this_folder without invisibles
repeat with i from 1 to count of these_items
set this_item to alias ((this_folder as text) & (item i of these_items))
set the item_info to info for this_item
if folder of the item_info is true then
process_folder(this_item)
else if (alias of the item_info is false) and ¬
((the file type of the item_info is in the type_list) or ¬
the name extension of the item_info is in the extension_list) then
process_item(this_item)
end if
end repeat
end process_folder
on process_item(this_item)
tell application "Adobe InDesign CS2"
activate
open (this_item)
delay 1
save document 1 to (this_item as string) & "#"
close document 1 saving no
end tell
end process_item
What am i doing wrong? Any Ideas?
Greetings
Sebman
Model: Dual G5 - 2Ghz
AppleScript: 1.10.7
Browser: Firefox 2.0.0.1
Operating System: Mac OS X (10.4)