更新时间:2023-02-03 09:16:46
mcgrailm 和 James Bedford 的答案组合奏效.我将编辑方案..."的菜单单击循环,直到编辑方案表变得存在.我还必须在单击Run without building"之前激活应用程序.
A combination of mcgrailm and James Bedford's answers worked. I put the menu click for "Edit Schemes…" in a loop until the edit scheme sheet becomes existent. I also had to activate the application just before I clicked "Run without building".
代码:
tell application id "com.apple.dt.Xcode"
activate
end tell
tell application "System Events"
tell process "Xcode"
repeat until sheet 1 of window 2 exists
click menu item "Edit Scheme…" of menu "Product" of menu bar item "Product" of menu bar 1
tell application "Xcode"
activate
beep
end tell
end repeat
tell sheet 1 of window 2
set destination to pop up button 2 of group 1
click destination
set target to "iPad 4.3 Simulator"
click menu item target of destination's menu 1
set buildConfig to pop up button 3 of group 2
click buildConfig
click menu item "Debug" of menu 1 of buildConfig
click button "OK"
end tell
tell application "Xcode"
activate
beep
end tell
tell application id "com.apple.dt.Xcode"
activate
end tell
click menu item "Run Without Building" of menu 1 of menu item "Perform Action" of menu "Product" of menu bar item "Product" of menu bar 1
end tell
end tell