property TheItem : ""
set my TheItem to ((path to desktop) & "KPR_13939_SaveTheDate_FOIL 9.48.02 AM.ai" as text) as alias
tell application id "com.adobe.illustrator" -- Adobe Illustrator
activate
# set user interaction level to never interact
set user interaction level to interact with all
repeat until the (count of documents) is 0
close every document saving no
end repeat
set addBarCode to false
set my TheItem to my TheItem as alias
try
tell application "System Events" to tell process "Adobe Illustrator"
try
keystroke return
end try
end tell
activate
set theDwell to 16
set theStartTime to current date
with timeout of theDwell seconds
try
open my TheItem dialogs no -- as alias (don't use 'as alias' here or routine won't work)
end try
end timeout
if (current date) - theStartTime > theDwell - 1 then
activate
tell application "System Events" to tell process "Adobe Illustrator"
try
keystroke return
end try
do shell script ("sleep 0.4")
try
keystroke return
end try
end tell
tell current application to say ("We may have struck an Illustrator file with miss matched fonts. Fonts have been replaced by default fonts")
end if
on error errmsg number errnum
tell application "System Events" to display dialog "setup 1 " & errmsg
end try
repeat 2 times
tell application "System Events" to tell process "Adobe Illustrator"
try
click button "Continue" of window 1
end try
try
keystroke return
end try
end tell
end repeat
end tell