如何从Applescript启动illustrator的特定版本?
我安装了两个版本的Illustrator,Adobe Illustrator 2020和Adobe Illustrator CC 2019。如何确保从Applescript中选择Adobe Illustrator CC 2019 为此,我进行了以下applescript编码,但applescript会自动更改应用程序名称如何从Applescript启动illustrator的特定版本?,applescript,Applescript,我安装了两个版本的Illustrator,Adobe Illustrator 2020和Adobe Illustrator CC 2019。如何确保从Applescript中选择Adobe Illustrator CC 2019 为此,我进行了以下applescript编码,但applescript会自动更改应用程序名称 set theResult to every paragraph of (do shell script "mdfind 'kMDItemContentTypeTre
set theResult to every paragraph of (do shell script "mdfind 'kMDItemContentTypeTree == \"com.apple.application\"c' | sort")
set systemApps to {}
set applicationsApps to {}
set Version2019 to "" as string
set Version2020 to "" as string
repeat with i from 1 to number of items in theResult
set end of systemApps to item i of theResult
if item i of theResult contains "Adobe Illustrator CC 2019" then
set end of applicationsApps to item i of theResult
set Version2019 to "true" as string
exit repeat
end if
end repeat
repeat with i from 1 to number of items in theResult
set end of systemApps to item i of theResult
if item i of theResult contains "Adobe Illustrator 2020" then
set end of applicationsApps to item i of theResult
set Version2020 to "true" as string
exit repeat
end if
end repeat
--display dialog (Version2019)
tell application "Finder"
if (Version2019 contains "true" and Version2020 contains "true") then
--display dialog "hey! " & theUser & return & return & "Adobe Illustrator 2019 and Adobe Illustrator 2020 available in this Mac" buttons {"Ok"}
set questionStudio to display dialog "hey! " & return & return & "Adobe Illustrator 2019 and Adobe Illustrator 2020 available in this Mac." & return & return & "Please select Version:" buttons {"Adobe Illustrator CC 2019", "Adobe Illustrator 2020", "Cancel"}
set answerStudio to button returned of questionStudio
if answerStudio contains "Adobe Illustrator 2020" then
tell application "/Applications/Adobe Illustrator 2020/Adobe Illustrator.app"
if it is not running then launch
end tell
it is running
return 0
else if answerStudio contains "Adobe Illustrator 2019" then
tell application "/Applications/Adobe Illustrator CC 2019/Adobe Illustrator.app"
if it is not running then launch
end tell
it is running
return 0
else if answerStudio contains "Cancel" then
tell me to quit
end if
else if (Version2019 contains "true") then
--tell application "Finder"
set appVersion to "Adobe Illustrator 2019"
--end tell
else if (Version2020 contains "true") then
--tell application "Finder"
set appVersion to "Adobe Illustrator 2020"
--end tell
end if
end tell
使用应用程序的完整路径,而不仅仅是其名称 还要注意,Finder中显示的应用程序名称可能不是它的真实文件名 获取应用程序完整路径的最简单方法就是将其图标拖放到脚本编辑器窗口中 例如:
tell application "/Applications/Adobe Illustrator 2020/Adobe Illustrator.app"
…
end tell
我没有使用applescript的经验,但我注意到您在几个地方缺少2019版的
CC
。如果该CC
是名称的一部分,这可能是它找不到它并默认为2020的原因吗?感谢您的检查和通知。实际上,Applescript在编译脚本时会自动更改应用程序名称,这是这里的主要问题。不允许Apple脚本在应用程序名称中指定版本。我也不熟悉这个苹果脚本,所以我不知道如何解决这个问题。如果可以的话,请帮我解决这个问题。谢谢你的检查。我使用了相同的,但我会再次检查我的脚本。