一段时间后,我不得不使用AppleScript从Cocoa应用程序控制iTunes,并使用NSAppleScript
。我不知道该脚本桥,我会在这看看,但它是非常简单与NSAppleScript
:
NSString *source = @"tell application \"iTunes\" to set sound volume to sound volume - 1";
NSAppleScript *script = [[NSAppleScript alloc] initWithSource:source];
[script executeAndReturnError:nil];
我从来没有以这种方式控制iTunes的任何麻烦,我敢肯定它也适用于FileMaker。
有一件事我会提的是由写代码一点点容易已于NSAppleScript创建一个类别下面的方法:
+ (NSAppleEventDescriptor *)executeWithSource:(NSString *)source {
NSAppleScript *script = [[NSAppleScript alloc] initWithSource:source];
return [script executeAndReturnError:nil];
}
那把我的脚本代码到
[NSAppleScript executeWithSource:@"tell application \"iTunes\" ..."];
是你试图通过AppleScript/AppleEvents在Objective-C程序中与FileMaker进行通信,还是其他?你是否已经有了想要在Applescript Studio中运行的东西? – pft221
我已经使用Applescript完成了Applescript Studio中的应用程序,但希望将其转换为使用Scripting Bridge Framework。但我不想使用AppleScriptObjC。看看这里http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/ScriptingBridgeConcepts/UsingScriptingBridge/UsingScriptingBridge.html#//apple_ref/doc/uid/TP40006104-CH4-DontLinkElementID_12 – Andre
头文件应该提供一些见解,你可以发布他们吗? “ – Val