From Indesign with Like

As a desktop publisher you know that there are times when you need to quickly convert an Indesign file from one version to another for one reason or another. The client uses one version and the contractor needs another, there’s a person in your office with a bizarre obsession with CS5.5 and refuses to use anything else, etc.
To that end I’ve used my limited Applescript knowledge to create an application which will take an Indesign file open it in Indesign CC, export an IDML, open that IDML in CS4 and export an INX. Resulting in three files all with the same filename other than the extension (INDD, IDML, INX).
This is particularly useful if you need to process files through SDLX and/or MemoQ. A cleaned file is ready to go in seconds! (Give or take. Depending on the size/complexity of the document of course.)
So here below is the code used in the application. Just copy and paste into the Applescript Editor, save it as an application and drag your Indesign files onto it. I currently have the application on my desktop. Wherever your Indesign file is the IDML and INX should be saved in the same directory.
The Code:
on open theFiles
tell application “System Events” to repeat with item_ in theFiles
set Path_ to path of item_
set fileName to text 1 thru -6 of Path_

end repeat
repeat with i from 1 to the count of theFiles
set this_item to item i of theFiles
try
tell application “Finder”
end tell
tell application “Adobe InDesign CC”
set user interaction level of script preferences to never interact
open this_item
end tell
delay 2
tell application “Adobe InDesign CC”
export front document format InDesign markup to fileName & “.idml”
end tell
delay 2
tell application “Adobe InDesign CC”
tell active document
close saving no
end tell
end tell
delay 2
tell application “Adobe InDesign CS4”
set user interaction level of script preferences to never interact
set theIDMLfile to fileName & “.idml”
open theIDMLfile
end tell
delay 2
tell application “Adobe InDesign CS4”
export front document format InDesign interchange to fileName & “.inx”
end tell
delay 2
tell application “Adobe InDesign CS4”
tell active document
close saving no
end tell
end tell
end try
end repeat


display dialog “IDML and INX files have successfully been created!”
end open
Notes:
  • Battle tested in Snow Leopard (10.6.8). Lightly tested in Lion (10.7.5)
  • Does not always handle multiple Indesign files at once well. Multiple small Indesign files maybe but I usually process them one at a time.
  • Does not always complete properly if other operations are attempted when application is running. Do other stuff at your own peril.
  • If you need something like this for Windows. I… Uh- Um…
Hope you can get some use out of it. It does the trick fairly well. If you have any questions, ask away. If they are intensive Applescript questions I may be dumbfounded but I’ll do my best. Feel free to modify the script to your own ends, evil or not, as I have it working just the way I need it and any attempts by me to tinker further will probably set off a chain reaction of unfathomable proportions. Probably, yeah.

No comments

Powered by Blogger.