1

I want to build and archive my project by command line (xcodebuild ,xcrun),and then open the xcode organizer window ,so that I can do "Submit to App Store" easily.However ,at the last step ,how can I open the xcode organizer window after archive automatically The script I used

xcodebuild -scheme DIDDemo archive

After the script works,I want to open the xcode organizer window : https://github.com/AHappyFish/imageCache/blob/master/23E6D725-F5C1-4BB2-BF9F-525228CD59E2.png

zmgift
  • 11
  • 6

2 Answers2

0

You can use AppleScript to control the user interface using "UI Scripting" which is intended for software designed to assist blind people/etc:

http://n8henrie.com/2013/03/a-strategy-for-ui-scripting-in-applescript/

However because of the security implications, in recent versions of OS X it can only be used by signed code, which means you will have to codesign AppleScript executable:

https://support.apple.com/en-us/HT202802

Abhi Beckert
  • 32,787
  • 12
  • 83
  • 110
0

Use Applescript at the end of the build process to activate Xcode's "Organizer" window:

tell application "System Events"
    tell application "Xcode"
        activate
        set index of window 1 where name contains "Organizer" to 1
    end tell
end tell

You might be able to use it within a shell script as well:

#!/bin/bash

as="tell application \"Xcode\" to set index of window 1 where name contains \"Organizer\" to 1"

osascript -e "$as"

*untested, so some fiddling might be required, but this should give you the basic idea.

l'L'l
  • 44,951
  • 10
  • 95
  • 146
  • I changed something add solved it https://github.com/AHappyFish/imageCache/blob/master/script – zmgift Sep 09 '15 at 09:29
  • Keep in mind that using "AXPress" can result in the potential issues Abhi described in his answer. – l'L'l Sep 09 '15 at 10:11
  • Yes,it's a new problem.And your script just open a window without UI elements ,so as you said " Actually I think Applescript should be able handle this without the need for GUI scripting or assistive access",can you give me more help.I'm a new Applescript. – zmgift Sep 10 '15 at 03:16
  • Ah...I took the wrong way,just open the "demo.xcarchive" with xcode – zmgift Sep 10 '15 at 08:46