Objective C脚本与FileMaker Pro 11的桥梁

时间:2011-09-20 07:38:15

标签: applescript filemaker scripting-bridge

我正在尝试使用脚本桥与FileMaker pro 11进行通信,我可以让它启动App,打开正确的数据库文件,但无法继续使用。

有没有人为FileMaker Pro获得一个示例脚本桥文件,一旦我能够了解2之间的沟通,我应该没问题。

我想将我在Applescript Studio中编写的应用转换为Objective C. 我知道Objective C,但可以了解FMP之间的沟通。

1 个答案:

答案 0 :(得分:-1)

前段时间我不得不使用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\" ..."];