Perforce and Xcode4

I created some AppleScripts that allow you to control some basic Perforce functionality in Xcode4, which was lost when Apple released the latest version of their IDE.

Perforce actually published a way of checking out files using the Behaviors functionality in Xcode (Xcode and P4), but I wanted a little more.

Note, these scripts are a work in progress. If you happen to make improvements, let me know so that those changes can be shared with the community.

You can download the AppleScripts here: xcode_p4_applescripts

The AppleScript files are also being hosted on the public Perforce swarm forum, located here: Perforce Public Swarm Server

Update 2013-11-06
I updated the AppleScripts to work with Xcode5 only and added a couple of new scripts.

The new applescript files are referenced in post Perforce and Xcode5

12 thoughts on “Perforce and Xcode4

  1. These are great! Any chance I can convince you to also publish them to the Perforce Public Depot? It’s going through some renovation work right now, but it’s our site for sharing tools with other Perforce users.

  2. Sure! I would love for the Apple development community, who are huge Perforce fans 🙂 of course, to have access to these AppleScripts.

  3. Hey !

    I will sound dumb, but how do you install these script ? How do you tell XCode to use them ?

    The whole applescript thing is kind of a mystery for me and I can seems to find any help with that :/

  4. If you are not using AppleScript at all, chances are, you don’t see the AppleScript drop down menu.

    So, to use the AppleScripts, you have to make sure the menu is available. This option can be turned on within the AppleScript editor app, located at “/Applications/Utilities/AppleScript”.

    After you open the AppleScript, open the preferences and make sure the “Show script menu in menu bar” option is selected. After you turn on that option, you should see an AppleScript icon in your menu bar.

    Next, open Xcode and from the AppleScript drop down menu, select “Open Scripts Folder->Open Xcode Scripts Folder”, which should open a folder for you in the Finder; usually, the path is “~/Library/Scripts/Applications/Xcode”.

    Copy the AppleScripts I made for Perforce into that folder and when you go back into Xcode, you should see each of the AppleScripts there for your use.

    Any one of the AppleScripts can be opened in the AppleScript Editor so you can see how they work, which I would suspect you would do if you are having problems with the scripts working.

    Usually, when people ask me about scripts that aren’t working, it’s because they haven’t set up the p4 command line app or, and usually more often the case, they didn’t set up the P4HOST or P4CLIENT settings in the ~/.bash_login file.

    Let me know if you have any other issues and I’ll try to assist.

    Happy Coding!

  5. Thanks ! Yep I have been looking at the script :), but did not find out how to get them to work within XCode, thanks a bunch for the reply.

    The next question is : is their anyway to automate the checking out of the file, using your script, while editing a file ? Or do I have to use the batch script ? It seems I can’t get any applescript file to work with the “script” option of the “behavior” menu.

  6. Thanks for your answer, this is what I’m using know, but I wanted to use your script instead.

    No worry any way, everything is working OK.

    Thanks a lot to share this !

  7. Hi Jamie,

    I was told by perforce to use the scripts you developed.
    Can we talk about it in details?

    Thx in advance,

    Rodney Allen

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.