Hi Guys!
I tried to write a Script to call with a System Service via a Shortcut to open a specific file, based on its filename extension. But the Applescript i wrote ends with an error message that the "name extension of" cannot be read.
Does anyone of you guys have an idea what i am doing wrong?
Thank you very much.
Here's my script:
This is intended to be a "Edit File" Script. For example: GIF-Files are normally linked with Preview-App. This is fine - but i want to call my Script to open it in Photoshop to edit it.
I tried to write a Script to call with a System Service via a Shortcut to open a specific file, based on its filename extension. But the Applescript i wrote ends with an error message that the "name extension of" cannot be read.
Does anyone of you guys have an idea what i am doing wrong?
Thank you very much.
Here's my script:
Code:
global appName
property image_extension_list : {"tif", "tiff", "gif", "png", "pict", "pct", "jpg", "jpeg"}
property text_extension_list : {"html", "txt", "css", "php", "js"}
on run {input, parameters}
tell application "Finder"
if (the name extension of the input is in the image_extension_list) then
set appName to "Adobe Photoshop CS3"
end if
if (the name extension of the input is in the text_extension_list) then
set appName to "TextMate"
end if
end tell
tell application appName
activate
open input
end tell
return input
end run
This is intended to be a "Edit File" Script. For example: GIF-Files are normally linked with Preview-App. This is fine - but i want to call my Script to open it in Photoshop to edit it.