如何在OS X下从Applescript调用可可方法

Nic*_*ico 5 macos cocoa applescript objective-c

在以前的OS X版本(10.6之前的版本)中,可以通过applescript(“ Applescript Studio”)中的“ call method”命令来调用Cocoa方法。例如,这种方式: “ Applescript编辑器”(10.6)中的脚本解释器不理解命令“ call method”。-“ Applescript编辑器”(10.6)是否等效? set theURL to "http://www.apple.com" set URLWithString to (call method "stringByAddingPercentEscapesUsingEncoding:" of theURL with parameter 30)

reg*_*633 3

您可以在applescript中使用“调用方法”。Apple 为 Automator 提供了这种能力,我们可以使用“Automator Runner”应用程序从 applescript 访问该能力。我最近刚刚向某人展示过这个。请参阅我的帖子#4 。

因此,要回答您的问题,只需将您的“调用方法”代码放入告诉应用程序“Automator Runner”告诉块中即可。