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

Update
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 Comments

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

  2. 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 :/

  3. 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 Editor.app”.

    After you open the AppleScript Editor.app, 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!

  4. 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.

  5. 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 !

  6. Hi Jamie,

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

    Thx in advance,

    regards
    Rodney Allen

Leave a Reply

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