为当前计算机上未安装的程序创建 AppleScript
我正在尝试制作两份 AppleScript 副本,一份适用于 Entourage,一份适用于 Outlook。我当前计算机上只安装了 Entourage。
根据 Microsoft 网站上的信息,两个应用程序都具有相同的 AppleScript 命令库,我应该能够简单地更改脚本中引用的应用程序名称。
更改:
Tell application "Microsoft Entourage"
为
Tell application "Microsoft Outlook"
阻止我保存脚本,因为我在此计算机上没有安装 Outlook。有什么办法解决这个问题吗?我是否需要使用文本编辑器来编辑实际的脚本文件并在那里进行更改?
谢谢!
I'm trying to make two copies of an AppleScript, one that works for Entourage and one for out Outlook. I only have Entourage installed on the current computer.
According to the info on Microsoft's site, both applications have the same library of AppleScript commands, and I should be able to simply change the application name referenced within the script.
Changing:
Tell application "Microsoft Entourage"
to
Tell application "Microsoft Outlook"
Prevents me from saving the script because I don't have outlook installed on this computer. Is there any way around this? Do I need to use a text editor to edit the actual script file and change it there?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
以下解决方法可能会解决问题。在安装 Entourage 的计算机上,using terms 指令将允许您编译脚本,即使未安装 Outlook:
编译并保存脚本后,AppleScript 编辑器会提示您缺少 Outlook 应用程序,但它仍然会生成已编译的 AppleScript 文件 (.scpt)。
The following work-around may do the trick. On the computer where Entourage is installed, a using terms directive will let you compile the script, even if Outlook is not installed:
Upon compiling and saving the script the AppleScript Editor will bug you about the missing Outlook application, but it will nevertheless produce a compiled AppleScript file (.scpt).
Applescript 是一种预先编译的文件格式,这意味着每次您单击“保存”时,它都会运行一系列步骤以确保脚本能够正常工作,但只是缺少实际运行脚本的逻辑。这些步骤的一部分是查找该应用程序,看看它是否存在于 Mac 上。
简而言之,如果您想将脚本另存为Applescript,则需要安装目标应用程序,否则您可以将脚本另存为文本文件并将文件移动到目标Mac以在那里另存为Applescript。
Applescript is a pre-complied file format, meaning that every time you click "Save" it runs through a series of steps to ensure the script will work, but just short of actually running through the script's logic. Part of those steps is to look for the application to see if it exists on the Mac.
In short, if you want to save the script as an Applescript, you need the target application installed, otherwise you can save the script as a text file and move the file over to the target Mac to save as an Applescript over there.
应该可以制作一个同时适用于 Entourage 和 Outlook 的脚本,而不会在编译或运行时找不到脚本时打扰您。我没有 Entourage 或 Outlook,但它应该像这样工作:
“使用来自的术语”仅在编译脚本时相关 - 运行时不需要它,但由于某种原因,如果该应用程序您仍然会受到窃听没有找到。因此,通过将其包装在脚本对象中,然后将该脚本写入文件,生成的脚本仍将运行,但不会包含“使用术语”,因此不会给用户带来麻烦。
为了获得对正确应用程序的引用,Finder 可以通过 ID 查找它,如果找不到,则简单地显示错误,而不是骚扰用户。您需要在那里插入正确的 ID,我不知道它们是什么。
It should be possible to make one script that works with both Entourage and Outlook, without bugging you if one isn't found either when you compile or when you run. I don't have either Entourage or Outlook but it should work like this:
"using terms from" is only relevant when compiling the script - it isn't needed when running, though for some reason you'll still get bugged if that app isn't found. So by wrapping it around a script object and then writing out that script to file, the resultant script will still run but won't contain "using terms from" and so won't bug the user.
For getting a reference to the right app, Finder can look for it by ID and simply error if it isn't found rather than bugging the user. You'll need to insert the proper ID's there, I don't know what they are.