5

我想从命令行启动一个应用程序并立即将 XCode 4 中的图形调试器附加到它,而不必单击 Xcode 菜单 Product->Attach To Progress。是否可以使用 bash 或 Apple 脚本编写脚本?

4

2 回答 2

2

这似乎适用于 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
于 2015-03-02T18:43:16.063 回答
1

为 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
于 2021-02-09T03:52:47.963 回答