首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用AppleScript从AppleScript文件(.scpt)读取代码

使用AppleScript从AppleScript文件(.scpt)读取代码
EN

Stack Overflow用户
提问于 2014-02-24 17:46:01
回答 1查看 2.1K关注 0票数 2

我希望使用AppleScript文件(.scpt)使用AppleScript获取代码。我尝试了显而易见的:

代码语言:javascript
复制
set the_file to choose file -- Assume the user chooses a .scpt file
read the_file

但是,如果选择这样的脚本(如AppleScript编辑器中所示),结果将是:

这是:

代码语言:javascript
复制
"FasdUAS 1.101.10ˇˇˇˇ
k
lˇ˛ˇ˛;5 By Richard Kulesus, 2009.  Released without license!±     j By Richard Kulesus, 2009.  Released without license!


lˇ˝
ˇ˝ Use this for whatever!
±. Use this for whatever!
lˇ¸ˇ¸OI I seriously despise code authors who copyright tiny bits of obvious code±í I seriously despise code authors who copyright tiny bits of obvious code
lˇ˚ˇ˚PJ like it's some great treasure.  This is small and simple, and if it saves±î like it's some great treasure.  This is small and simple, and if it saves
lˇ˙ˇ˙LF the next guy some time and trouble coding applescript I'll feel good!±å the next guy some time and trouble coding applescript I'll feel good!
lˇ˘ˇ¯ˇ˜ˇ˘ˇ¯ˇ˜ !
 lˇˆ\"#ˇˆ\">8 Quickly change all the hot-corners to do what you want.#±$$p Quickly change all the hot-corners to do what you want.!%&
%lˇı'(ˇı'C= Particularly useful for presentations and full-screen games.(±))z Particularly useful for presentations and full-screen games.&*+

(等)

而不是这个:

代码语言:javascript
复制
-- By Richard Kulesus, 2009.  Released without license!
-- Use this for whatever!
-- I seriously despise code authors who copyright tiny bits of obvious code
-- like it's some great treasure.  This is small and simple, and if it saves
-- the next guy some time and trouble coding applescript I'll feel good!
--
-- Quickly change all the hot-corners to do what you want.

(等)

这个问题有什么解决办法吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-02-24 20:40:39

由于调用了osadecompile实用程序,我遇到的另一种方式(虽然可能无法接受)是:

代码语言:javascript
复制
set scriptContent to do shell script "osadecompile " & quoted form of POSIX path of (choose file)
票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/21995063

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档