使用 ScriptingBridge 表达范围(或切片)
我正在尝试使用 Scripting Bridge 在 Objective-C 中表达切片(“通过 AppleScript”)。 示例代码在 iWorks Pages 中进行选择。 AppleScript 代码如下所示
tell application "Pages"
tell document 1
select (characters 8 thru 14)
end tell
end tell
,Objective-C 代码在这里。我需要的是一种在 Objective-C 中表达(字符 8 到 14)的方式。
PagesApplication *app;
app = [SBApplication applicationWithBundleIdentifier:@"com.apple.iWork.Pages"];
SBElementArray *docs = [app documents];
PagesDocument *doc = [docs objectAtIndex:0];
// now we need to express
// "select (characters 8 thru 14)" in obj-c
// ??
感谢您的任何帮助。比约恩
I'm trying to express a slice ("thru in AppleScript") in Objective-C using Scripting Bridge.
The example code is making a selection in iWorks Pages.
The AppleScript code looks like this
tell application "Pages"
tell document 1
select (characters 8 thru 14)
end tell
end tell
and the Objective-C code is here. What I need is a way of expressing (characters 8 thru 14) in Objective-C.
PagesApplication *app;
app = [SBApplication applicationWithBundleIdentifier:@"com.apple.iWork.Pages"];
SBElementArray *docs = [app documents];
PagesDocument *doc = [docs objectAtIndex:0];
// now we need to express
// "select (characters 8 thru 14)" in obj-c
// ??
Thankful for any help. Björn
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我必须使用低级别的 AppleEvents。是否从命令行监视 Apple 事件。
这是执行此操作的代码:
I had to use low level AppleEvents. Did monitor the Apple Events from the command line.
Here is a code that does it: