简体   繁体   中英

How can I open the xcode organizer window by command line

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

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM