Xcode 4 Script User

I have been using Xcode for one year and I made a user script in Python. This script gets the whole document, gets the cursor position thanks to %%% {PBXSelectionStart} %%%, does some very useful things and replaces the entire current document without moving the cursor.

It works great.

But I upgraded to Xcode 4, and it seems that user scripts are not supported! How can I continue to use my script?

(I'm trying to use an automaton, but I cannot use the variable %%% {PBXSelectionStart} %%% for the cursor position, and I have to select the whole document in Xcode ...)

Thanks in advance!

+4
source share
3 answers

Yes, it looks like Apple has refused user support for the script :-( The only thing you can do is (from the Apple Developer Forum):

Your only option is to drop it into ~ / Library / Scripts, and then go to File> Services> Service Settings ... and set the key combination.

This works, but it is only an incomplete replacement, as you will not have all the features that you used for custom Xcode scripts in Xcode 3 :-(

Here is a message showing you how to create an Automator action that you can use as a service in Xcode (through the service menu and assign a shortcut as above). I also did this (modifying one of my scripts to read input from stdin and write the output to stdout) and it works ... as I said above, it is quite limited and it is ten times slower than before, but better than nothing.

+3
source

I ran into the same problem and put together a shell script that allows Xcode 4 to run custom Xcode 3 scripts.

It works by replacing old variables like %%% {PBXFilePath} %%% in your scripts with values ​​that sparkle with Xcode 4 via AppleScript.

Its available on github. https://bitly.com/HXHiij

0
source

Source: https://habr.com/ru/post/1338896/


All Articles