【问题标题】:How do you use handler form another script你如何使用来自另一个脚本的处理程序
【发布时间】:2013-09-03 12:37:53
【问题描述】:

在 AppleScript 中如何使用来自另一个脚本的处理程序?

我试过了

set test to (load script "/Users/username/Desktop/test.scpt")

test()

这是桌面上的 test.scpt

display dialog "test"

当我运行第一个脚本时

错误“«脚本»不理解测试消息。”从«script»到«class test»的数字-1708

【问题讨论】:

    标签: applescript handler


    【解决方案1】:

    您需要将要调用的代码包装在处理程序中:

    test.scpt:

    on doTest()
        display dialog "test"
    end doTest
    

    然后执行它:

    set test to (load script "/Users/username/Desktop/test.scpt")
    tell test to doTest()
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-05-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-12-03
      • 1970-01-01
      • 1970-01-01
      • 2023-02-02
      相关资源
      最近更新 更多