我想从命令行启动一个应用程序,并立即将XCode 4中的图形调试器附加到它,而无需单击Xcode菜单Product-> Attach To Progress。是否可以使用bash或Apple脚本编写脚本?
答案 0 :(得分:0)
这似乎适用于Xcode-Beta版本6.2(6C121)。对于Xcode,只需更改" Xcode-Beta"到Xcode。此外,您还想要更改流程名称" Staging"到你想要附加的过程。
tell application "Xcode-Beta"
activate
end tell
tell application "System Events"
tell application process "Xcode"
click (menu item "By Process Identifier (PID) or Name…" of menu 1 of menu item "Attach to Process" of menu 1 of menu bar item "Debug" of menu bar 1)
end tell
tell application process "Xcode"
set value of text field 1 of sheet 1 of window 1 to "Staging"
end tell
tell application process "Xcode"
click button "Attach" of sheet 1 of window 1
end tell
end tell
答案 1 :(得分:0)
适用于 Xcode 12
tell application "Xcode"
activate
end tell
tell application "System Events"
tell application process "Xcode"
click (menu item "Attach to Process by PID or Name…" of menu 1 of menu bar item "Debug" of menu bar 1)
end tell
tell application process "Xcode"
set value of text field 1 of sheet 1 of window 1 to "Your App/Process Name"
end tell
tell application process "Xcode"
click button "Attach" of sheet 1 of window 1
end tell
end tell
tell application "our App/Process Name"
activate
end tell