I’m really banging my head against a wall here, I need to open an illustrator file
in text edit, one of the problems I’ve got is I can’t use automator or choose file
in applescript, I need to be able to just select the file and run the script.
this is going to form part of a larger workflow.
tell application "Finder"
set theFile to the selection
end tell
tell application "TextEdit"
activate
open theFile
end tell
been playing around with this but get the error
Can’t make «class docf» “Return_Path2.scpt” of «class cfol» “Desktop” of «class cfol» “Dorn” of «class cfol» “Users” of «class sdsk» of application “Finder” into the expected type.
I should know this but I can’t get it work again,
what do I need to do so the script will only accept files
with the extension .ai, I’ve sorted my dialog, warning symbol and buttons
but i can’t work how to get the script to error on any other extensions
Since you are using Finder selections you could do something like this:
tell application "Finder"
set theFile to selection
if (count of theFile) is 1 then
set theFile to theFile as string
if name extension of alias theFile is "ai" then
display dialog "Illustrator File"
else
display dialog "Not an Illustrator file"
end if
else
display dialog "You can only have one file selected"
end if
end tell