问题描述
有没有使用其他定义的AppleScript AppleScript的方法引用该原始的AppleScript与同类进口一些指标(如在PHP)?
Is there a way to use defined AppleScript methods in other AppleScripts which reference the original AppleScript with something similar to import (f.e. in PHP)?
我写了一个梅索德设置的Skype状态和心情文字:
I wrote a methode to set Skype status and mood-text:
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
现在我在寻找类似导入skype_methods.scpt 。是否有这样的功能。我可以用谷歌不是相关的。
now I'm searching for something like import skype_methods.scpt. Is there such a functionality. I can't something related with Google.
推荐答案
导入另一个脚本作为一个库是定义它是由加载库作为脚本对象初始化的属性的一种方式。然后,您可以使用告诉
命令来调用库函数。
One way to import another script as a library is to define a property which is initialized by loading the library as a script object. You can then use the tell
command to invoke the library functions.
property pSkypeLibrary : load script POSIX file "/Users/sakra/Desktop/skype_methods.scpt"
tell pSkypeLibrary
setSkypeStatus("status", "mood")
end tell
这篇关于导入AppleScript的方法在另一个AppleScript的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!