gpt4 book ai didi

include - AppleScript 中的 #include like 指令

转载 作者:行者123 更新时间:2023-12-04 13:24:57 25 4
gpt4 key购买 nike

这个问题在这里已经有了答案:




11 年前关闭。




Possible Duplicate:
Import AppleScript methods in another AppleScript?



AppleScript 中有什么东西可以像 #include 一样使用吗? C中的指令?

例如:
INCLUDE_DIRECTIVE "Path/To/Applescript.scpt"

//Some AppleScript code here

最佳答案

您绝对可以这样做,并且有两种变体。第一个加载整个脚本:

脚本 Foo.scpt

set theBar to "path:to:Bar.scpt" as alias
run script (theBar)

脚本栏.scpt
display dialog "Bar"
--Result: A window that displays "Bar"

第二个允许您加载脚本并调用该脚本中的特定方法:

文件
property OopLib : load script POSIX file "/Users/philipr/Desktop/OopLib.app"
tell OopLib
set theResult to Oop(1)
display dialog theResult
end tell
--> result: Window displaying "Eek: 1"

对象库文件
on Oop(Eek)
display dialog Eek
return "Eek: " & Eek
end Oop

关于include - AppleScript 中的 #include like 指令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3027360/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com