Xcode 4 lacks proper scripting support

Originator:andre.bergmedia
Number:rdar://12234399 Date Originated:05-Sep-2012 04:23 AM
Status:Open Resolved:
Product:Developer Tools Product Version:Xcode 4.2 Build 4C199
Classification:UI/Usability Reproducible:Always
 
Summary:
Compared to the User Scripts menu in Xcode 3, Xcode 4 lacks anything beyond rudimentary scripting support. 

AppleScripting is still completely hosed, the Behaviours feature only allows for running scripts without any sort of context like "current selection" and other useful variables. 

This means that currently one has to script Xcode in 2 places depending on whether one wants to operate on the selected text (Automator+Run Shell Script phase with replace selected text enabled) or on all the files. 
As far as I can see, there is no easy way to operate on just a subset of files belonging to the currently active project. Pardon my opinion but this seems absurd for a professional tool like Xcode 4.

Steps to Reproduce:
1. Open any project
2. Try to automate tasks suitable for scripting that operate on different levels of input: selected text, active file, all files of certain type etc.

Expected Results:
Xcode should make this easy and ideally make it accessible from one spot.

Actual Results:
Xcode currently doesn't do it at all or makes it harder than it needs to be.
Also it splits functionality across different programs.

Regression:
Working fine in Xcode 3. Currently missing in action:

• Environment variables:
  %%%{PBXSelectionStart}%%%
  %%%{PBXSelectionEnd}%%%
  %%%{PBXFilePath}%%%
  %%%{PBXAllText}%%%
  %%%{PBXTextLength}%%%

• Options for Script Input
  Selection
  Entire Document

• Options for Script Output:
  Replace Selection
  Replace Document Contents
  Display in Alert
  Insert after Selection
  Insert after Document Contents
  Place on Clipboard
  Open in New Document
  Open as HTML

• Options for Error Output:
  Display in Alert
  Place on Clipboard
  Merge with script output

• The built-in script editor and organizer

Notes:

I found the list posted in Regression in a Cocoabuilder post. 
It mentions that the built-in script editor should be brought back.
In my opinion I think it would suffice if the options present for a script in the script editor be put together with the behaviour's Run Script: drop down, maybe right below it so that they can become active once a script has been selected.
We can write the scripts themselves with another editor (like TextMate, BBEdit, etc.).

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!