Switch tabs in XCode "Organizer"

Dear everyone,

I recent wrote a very small AppleScript as part of my whole automation script. What I wanna do it start Xcode → choose “Window” from the menu → click on “Organizer” from the menu → click on “Device” button from “Organizer” → choose “Editor” from menu → Click on “Refresh from Developer Portal”. The incomplete code is provided in the following.

Actually the only problem I have got so far is this step “click on “Device” button from “Organizer”” because sometime the focus is not on “Device” but other tabs (don’t know how to attach a screenshot to this forum) and I have no idea of how to switch between them. I know I can use “Select Next Tab” menu item to switch to the next one but how to decide which tab (maybe by tab name) I have already switched to?

Actually I even do not know whether I should call them “tabs”. They maybe “button”. I tried using “button” but it did not work for it.

Any hint is much appreciated!

Cheers
Daniel

tell application “Xcode” to activate

#Activate “Organizer”
tell application “System Events”
tell process “Xcode”
tell menu bar 1
tell menu bar item “Window”
tell menu “Window”
click menu item “Organizer”
In here, I need to switch between tabs and choose the tab “Device”
end tell
end tell
end tell
end tell
end tell

delay 2

#tell application “System Events”

tell process “Xcode”

click button “Devices” of button group of window “Organizer”

#click button “Radio On” of tab group 1 of window “Wireless Utility”

end tell

#end tell

#Refresh the provisioning profile
tell application “System Events”
tell process “Xcode”
tell menu bar 1
tell menu bar item “Editor”
tell menu “Editor”
click menu item “Refresh from Developer Portal”
delay 2
keystroke (ASCII character of 13)
end tell
end tell
end tell
end tell
end tell

Following should be the answer:

tell application “Xcode” to activate

#Activate “Organizer”
tell application “System Events”
tell process “Xcode”
tell menu bar 1
tell menu bar item “Window”
tell menu “Window”
click menu item “Organizer”
end tell
end tell
end tell
end tell
end tell

delay 2

tell application “System Events”
tell process “Xcode”
click button “Devices” of tool bar 1 of window 1
end tell
end tell

#Refresh the provisioning profile
tell application “System Events”
tell process “Xcode”
tell menu bar 1
tell menu bar item “Editor”
tell menu “Editor”
click menu item “Refresh from Developer Portal”
delay 2
keystroke (ASCII character of 13)
end tell
end tell
end tell
end tell
end tell