一段時間後,我不得不使用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