为当前计算机上未安装的程序创建 AppleScript

发布于 2024-11-14 12:50:04 字数 410 浏览 1 评论 0原文

我正在尝试制作两份 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

只是在用心讲痛 2024-11-21 12:50:04

以下解决方法可能会解决问题。在安装 Entourage 的计算机上,using terms 指令将允许您编译脚本,即使未安装 Outlook:

set theApp to a reference to application "Microsoft Outlook"
using terms from application "Microsoft Entourage"
    tell theApp
        get version
        ...
    end tell
end using terms from

编译并保存脚本后,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:

set theApp to a reference to application "Microsoft Outlook"
using terms from application "Microsoft Entourage"
    tell theApp
        get version
        ...
    end tell
end using terms from

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).

盗琴音 2024-11-21 12:50:04

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.

晨曦慕雪 2024-11-21 12:50:04

应该可以制作一个同时适用于 Entourage 和 Outlook 的脚本,而不会在编译或运行时找不到脚本时打扰您。我没有 Entourage 或 Outlook,但它应该像这样工作:

using terms from application "Microsoft Entourage"
    script theScript
        tell application "Finder" to try
            set theApp to application file id "Entourage's Bundle ID" as text
        on error
            set theApp to application file id "Outlook's Bundle ID" as text
        end try
        tell application theApp
            -- do stuff
        end tell
    end script
end using terms from
store script theScript in "MyScript.scpt"

“使用来自的术语”仅在编译脚本时相关 - 运行时不需要它,但由于某种原因,如果该应用程序您仍然会受到窃听没有找到。因此,通过将其包装在脚本对象中,然后将该脚本写入文件,生成的脚本仍将运行,但不会包含“使用术语”,因此不会给用户带来麻烦。

为了获得对正确应用程序的引用,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 application "Microsoft Entourage"
    script theScript
        tell application "Finder" to try
            set theApp to application file id "Entourage's Bundle ID" as text
        on error
            set theApp to application file id "Outlook's Bundle ID" as text
        end try
        tell application theApp
            -- do stuff
        end tell
    end script
end using terms from
store script theScript in "MyScript.scpt"

"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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文