在另一个AppleScript中导入AppleScript方法?

Jen*_*ohl 22 import applescript

有没有办法在其他AppleScripts中使用定义的AppleScript方法,这些方法引用了与导入类似的原始AppleScript(PHP中的fe)?

我写了一个设置Skype状态和情绪文本的方法:

on setSkypeStatus(status, mood_text)
    tell application "System Events"
        set skypeRunning to count (every process whose name is "Skype")

        if skypeRunning > 0 then --only set status if skype is running
            tell application "Skype"
                set myStatus to "SET USERSTATUS " & status
                set myMood to "SET PROFILE MOOD_TEXT " & mood_text

                send command myStatus script name "AppleScript"
                send command myMood script name "AppleScript"
                return skypeRunning
            end tell
        else
            return skypeRunning
        end if
    end tell
end setSkypeStatus
Run Code Online (Sandbox Code Playgroud)

现在我正在寻找像import skype_methods.scpt这样的东西.有没有这样的功能.我不能与谷歌有关.

sak*_*kra 23

将另一个脚本作为库导入的一种方法是定义一个属性,该属性通过将库加载为脚本对象来初始化.然后,您可以使用该tell命令调用库函数.

property pSkypeLibrary : load script POSIX file "/Users/sakra/Desktop/skype_methods.scpt"

tell pSkypeLibrary
    setSkypeStatus("status", "mood")
end tell
Run Code Online (Sandbox Code Playgroud)