[Note: It is a shame that XCode 4 does not have the Scripts menu]
XCode has the following scripts:
XCode has the following scripts:
- Delete Line
- Move Line Up
- Move Line Down
- Copy Line Up
- Copy Line Down
However there was a problem. The script always worked on the first text document. That meant that when you had multiple documents open, the commands sometimes modified the document which did not have focus (baaad!).
It turns out the window 1 is always the window which has the focus. I corrected the scripts to make use of this fact. Here is the general strategy behind the modifications I made to the scripts:
Download the scripts here. Just unzip and drop the scripts in /Developer/Library/Xcode/User Scripts/ .
I have filed a bug at http://radar.apple.com for this. The problem Id is 9138643. I have attached the fixed scripts to the problem.
It turns out the window 1 is always the window which has the focus. I corrected the scripts to make use of this fact. Here is the general strategy behind the modifications I made to the scripts:
:
: using terms from application "Xcode" set selectedDocument to missing value repeat with index from 1 to (count of text documents) if (associated file name of window 1 as string) is equal to (path of text document index) then -- found the document set selectedDocument to (text document index) exit repeat end if end repeat if (selectedDocument is not missing value) then tell selectedDocument -- do the modifications to document end tell else beep 1 end if end using terms from
Download the scripts here. Just unzip and drop the scripts in /Developer/Library/Xcode/User Scripts/ .
I have filed a bug at http://radar.apple.com for this. The problem Id is 9138643. I have attached the fixed scripts to the problem.
4 comments:
This is wonderful blog. I love it.
How do you use them? I dropped into the folder mentioned above but can't get them work in Xcode 4 :(
As noted at the top of the blog entry, Apple removed the Scripts support in Xcode 4. I am investigating other approaches to support it.
Post a Comment