你是怎么做到的AppleScript的一个包括哪些内容? [英] How do you do an include in applescript?

查看:277
本文介绍了你是怎么做到的AppleScript的一个包括哪些内容?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一堆code的我想在几个不同的AppleScript使用,所以我想放进它自己的AppleScript,我可以从其他的AppleScript参考。基本上我想做一个包含。这是如何在AppleScript的怎么办?

I have a bunch of code I want to to use in several different applescripts so I would like to put it into it's own applescript that I can reference from other applescripts. Basically I want to do an include. How is this done in applescript?

推荐答案

下面是我发现做到这一点的最好办法。你可以调用一个函数像这样一个脚本:

Here is the best way I have found to accomplish this. You can call a function on another script like so:

剧本 a.scpt

set myScript to load script "b.scpt"
set foo to myScript's theTest()

剧本 b.scpt

on theTest()
       return true
end theTest

正如你可以看到你可以b.scpt距离a.scpt通过调用函数名myScript的的theTest()调用的函数。

As you can see you can call functions within b.scpt from a.scpt by calling the function name myScript's theTest().

这篇关于你是怎么做到的AppleScript的一个包括哪些内容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆