Extracting Illustrator text for metadata

My first script is designed to extract the text of an Illustrator document and paste it in the IPTC “Description” field, making the content searchable in Bridge. This was cobbled together from code pulled from these forums.

Requires some set up in Illustrator CS2

  1. In Illustrator, create a new Action Set and name it “Custom.”
  2. Record a new Action where you export the document as text
    to the Desktop. Be sure to name the file “GraphicsText.txt”
  3. Name the Action “Export to text”

tell application "Adobe Illustrator"
	tell document 1
		do script "Export as text" from "Custom"
	end tell
end tell
tell application "TextEdit"
	open (my (path to desktop folder) as string) & "GraphicsText.txt"
end tell
tell application "TextEdit" to activate
tell application "System Events" to keystroke "ac" using command down
tell application "Adobe Illustrator"
	activate
end tell
tell application "System Events"
	tell process "Adobe Illustrator"
		tell menu bar 1
			tell menu bar item "File"
				tell menu "FIle"
					pick menu item "File Info..."
					keystroke tab
					keystroke tab
					keystroke tab
					keystroke tab
					keystroke "v" using command down
					
				end tell
			end tell
		end tell
	end tell
end tell

Model: Mac Dual 2.5 Ghx G5
AppleScript: AppleScript 1.10.6
Browser: Safari 417.9.3
Operating System: Mac OS X (10.4)