【问题标题】:Applescript and CocoaApplescript 和可可
【发布时间】:2011-11-13 13:21:43
【问题描述】:

我想通过 applescript 在可可应用中调用 IBAction:

我想打电话:

    - (IBAction)reverse:(id)pId;
    {
        direction = -1;

    } 

在外部 applescript 文件中有一行,例如:

    tell application "theapp"
    reverse
    end tell

有什么想法吗?

提前致谢

【问题讨论】:

    标签: cocoa applescript


    【解决方案1】:

    使用 NSAppleScript。

    NSAppleScript *as = [[NSAppleScript alloc] initWithSource:@"tell application \"theapp\"\nreverse\nend tell"];
    NSDictionary *err = nil;
    NSAppleEventDescriptor *desc = [as executeAndReturnError:&err];
    NSLog(@"Error: %@\nData: %@", err, desc.data);
    [as release];
    

    关于Scripting Bridge here也有很好的回答

    【讨论】:

      猜你喜欢
      • 2011-12-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-03-08
      • 1970-01-01
      • 2011-01-12
      • 2021-04-14
      • 1970-01-01
      相关资源
      最近更新 更多