0

Rob Napier のScripting Bridge チュートリアルに従って、データベース イベント アプリ用に生成されたヘッダーを設定することができました/System/Library/CoreServices/Database Events.app。現在、Scripting Bridge を使用して と同等の機能を実行しようとしていますtell database "My Database"

Scripting Bridge 経由で実行しようとしている対応する AppleScript は次のとおりです。

tell application "Database Events"
    tell database "My Database"
        -- ...
    end tell
end tell

しかし、Scripting Bridge でこれを行うにはどうすればよいでしょうか。

生成されたヘッダーには次が含まれます。

// An application's top level scripting object.
@interface DatabaseEventsApplication : SBApplication
+ (DatabaseEventsApplication *) application;

- (SBElementArray *) documents;
- (SBElementArray *) windows;

@property (readonly) BOOL frontmost;  // Is this the frontmost (active) application?
@property (copy, readonly) NSString *name;  // The name of the application.
@property (copy, readonly) NSString *version;  // The version of the application.

- (DatabaseEventsDocument *) open:(NSURL *)x;  // Open an object.
- (void) print:(NSURL *)x printDialog:(BOOL)printDialog withProperties:(DatabaseEventsPrintSettings *)withProperties;  // Print an object.
- (void) quitSaving:(DatabaseEventsSavo)saving;  // Quit an application.

@end

//...

@interface DatabaseEventsDocument : DatabaseEventsItem

@property (readonly) BOOL modified;  // Has the document been modified since the last save?
@property (copy) NSString *name;  // The document's name.
@property (copy) NSString *path;  // The document's path.


@end

//...

@interface DatabaseEventsDatabase : DatabaseEventsItem

- (SBElementArray *) records;

@property (copy, readonly) NSURL *location;  // the folder that contains the database
@property (copy, readonly) NSString *name;  // the name of the database


@end

//...

@interface DatabaseEventsApplication (DatabaseEventsSuite)

- (SBElementArray *) databases;

@property NSInteger quitDelay;  // the time in seconds the application will idle before quitting; if set to zero, idle time will not cause the application to quit

@end

open:メソッドを使用する必要がありますか? を検索しdatabasesますか? 他の何か?

4

1 に答える 1

0

私は働いたobjectWithName:方法を使用することを発見しましたSBElementArray

DatabaseEventsApplication *dbevApp = [SBApplication applicationWithBundleIdentifier:@"com.apple.databaseevents"];
DatabaseEventsDatabase *db = [[dbevApp databases] objectWithName:@"My Database"];

更新:これは、GitHub に投稿した小さなプロジェクト用でした: https://github.com/dtrebbien/Songs-Database-Viewer

于 2013-01-11T12:51:49.677 に答える