#!/usr/bin/ruby # Ian Haigh : http://ianhaigh.com/ # Save the frontmost document as an Illustrator 3 file. # Handy for programs that import Illustrator, but don't # recognise the latest versions (such as Cinema 4D) require "appscript" ai = Appscript.app("Adobe Illustrator.app") doc = ai.current_document original_path = doc.file_path.get.to_s # figure out the file path and name original_path =~ /(.+)\/(.+)\..+/ path, name = $1, $2 # I can't seem to duplicate "save as" functionality # we'll save it with a new name, close it, and re-open the original ai.save(doc, { :in => "#{path}/#{name}-ai3.ai", :as => :Illustrator, :with_options => { :compatibility => :Illustrator_3, :PDF_compatible => false, :flatten_output => :preserve_paths, :compressed => false } }) doc.close # re-open the original mac_alias = MacTypes::Alias.path(original_path) ai.open(mac_alias)