如何通过 Applescript 进入/退出/越过 Xcode 调试器?

发布于 2024-09-24 13:30:37 字数 352 浏览 3 评论 0原文

我正在开发一个 iOS 应用程序。我在模拟器上花了很多时间,如果我不必切换回 Xcode 来访问调试器单步进入/退出/结束/继续控制,那将会非常有帮助。有没有办法在 Xcode 不成为焦点应用程序的情况下做到这一点?

(我知道迷你调试器,但它没有步骤控件,而且我更喜欢键盘快捷键。)

我认为它可能是可编写脚本的,但似乎在Xcode AppleScript 字典。 (无论如何,我绝对不是 AppleScript 专家。)

我认为 GUI 脚本不会得到我想要的东西,因为它会切换到 Xcode 步骤并切换回来。但如果速度足够快,可能总比没有好。

有没有办法将键盘命令发送到没有焦点的应用程序?

还有其他想法吗?

I am developing an iOS application. I spend a lot of time in the simulator and it would be really helpful if I didn't have to switch back to Xcode to access the debuggers step in/out/over/continue controls. Is there a way to do this without Xcode being the application with focus?

(I know about the mini debugger, but that doesn't have step controls on it, and I'd prefer keyboard shortcuts.)

I thought it might be scriptable, but it didn't seem like there was a hook for it in the Xcode AppleScript dictionary. (I'm definitely not an AppleScript expert by any means, though.)

I don't think GUI scripting would get me what I want since it would switch to Xcode step and switch back. But it might be better than nothing if it was fast enough.

Is there a way to send a keyboard command to an application that's doesn't have focus?

Any other ideas?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

虐人心 2024-10-01 13:30:37

要查看 Xcode 的脚本支持,请启动脚本编辑器,找到“打开词典”命令,然后选择 Xcode。

To see Xcode's scripting support, launch Script Editor, find the Open Dictionary command, and select Xcode.

2024-10-01 13:30:37

正如其他人提到的,使用 UI 脚本。因此,要在调试器中单步执行代码,您可以在 Applescript 中使用此代码:

tell application "XCode"
    activate
    tell application "System Events" to keystroke "i" using {command down, shift down}
end tell

在 Appscript 中使用此代码:

app(u'Xcode').activate()
app(u'System Events').keystroke(u'i', using=[k.command_down, k.shift_down])

As others mentioned use UI scripting. So to step through code in the debugger you'd use this in Applescript:

tell application "XCode"
    activate
    tell application "System Events" to keystroke "i" using {command down, shift down}
end tell

And this in Appscript:

app(u'Xcode').activate()
app(u'System Events').keystroke(u'i', using=[k.command_down, k.shift_down])
墨洒年华 2024-10-01 13:30:37

如果不使用 UI 脚本,您似乎无法做到这一点,我试图避免这样做。 (不过,如果您想这样做,请参阅 Clark 的回答。) Xcode 3 和 Xcode 4.3.1 似乎就是这种情况。

It doesn't seem like you can do this without using UI scripting, which I try to avoid. (See Clark's answer if you want to do that, though.) This appears to be the case for Xcode 3 and Xcode 4.3.1.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文