Objective-C の Scripting Bridge で Apple Pages (iWork から) を使用しようとしています。
これは動作中の AppleScript です。
tell application "Pages"
set name of item 1 of contents of (get selection) to "myLittleTextBox"
end tell
Scripting Bridge を使用して Objective-C で同じことを達成するにはどうすればよいですか?
Cocoa Scripting Bridge と <contents> 要素の下でヒントを試しました が、うまくいきませんでした ...
奇妙なことに、プロパティの読み取りは問題ありません。
PagesApplication *myPages = [SBApplication applicationWithBundleIdentifier:@"com.apple.iWork.Pages"];
NSLog(@"myPages.selection.properties:%@",myPages.selection.properties);
...しかし、選択範囲内のオブジェクトを設定したり、アクセスしたりすることはできませんでした。
もちろん、AppleScript を介して送信することもできますNSAppleScript
が、それは簡単すぎます。;)