2 Replies Latest reply: Nov 8, 2012 5:17 PM by excellentsyt
excellentsyt Level 1 Level 1 (0 points)

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


OS X Mountain Lion (10.8.1)
  • 1. Re: Switch tabs in XCode "Organizer"
    Camelot Level 8 Level 8 (45,790 points)

    This is pretty easy. Just:

     

    click button "Devices"  of tool bar 1 of window 1

  • 2. Re: Switch tabs in XCode "Organizer"
    excellentsyt Level 1 Level 1 (0 points)

    Hi Gamelot,

     

    That solved my problem. Thanks a lot for that. "tool bar" should be used in that case.

     

    BTW, do you know anywhere to know more about the terminologies used in AppleScript?

     

    The whole code is:

     

    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