Re: target duplication with AppleScript
Re: target duplication with AppleScript
- Subject: Re: target duplication with AppleScript
- From: Philip Aker <email@hidden>
- Date: Sun, 24 May 2009 01:17:13 -0700
On 2009-05-23, at 18:05:27, Dmitry Markman wrote: I have a problem with target duplication via Applescript here is what I do
tell application "Xcode" set my_project to project of active project document set ts to targets of my_project set my_target to item 1 of ts tell my_project duplicate my_target -- duplicate target my_target end tell end tell
duplicate my_target doesn't work with an error "Xcode got an error: AppleEvent handler failed." duplicate target my_target doesn't work with an error "Xcode got an error: Can’t make target id \"DA3235600FC725BF00859B5D\" of project \"TestProject\" into type integer."
I think you should file a bug on the above. Seems to me it's a legitimate AppleScript _expression_ not implemented correctly in Xcode.
The following accounts for the case when the source_targ_name is the same name as the project (the default for many project templates). Then of course the second item in the list of rows returned from the query must be selected. Otherwise the first. I can only say this script works with Xcode 3.2.1 on my setup.
set source_targ_name to "BjörkedXcodeScripting"
tell application "System Events" to tell application process "Xcode" tell window 1 to tell group 1 to tell splitter group 1 to tell scroll area 1 to tell outline 1 set targets_row to item 1 of (get every row whose value of text field 1 of group 1 is "Targets") tell targets_row if (value of UI element 1 of group 1 = 0) then click UI element 1 of group 1 end if end tell set rowlist to (get every row whose value of text field 1 of group 1 is source_targ_name) if ((count of rowlist) is 1) then select item 1 of rowlist else if ((count of rowlist) is 2) then select item 2 of rowlist end if end tell set frontmost to true tell menu bar 1 to tell menu 1 of menu bar item "Edit" click menu item "Duplicate" end tell end tell
Philip Aker echo email@hidden@nl | tr a-z@. p-za-o.@ Democracy: Two wolves and a sheep voting on lunch.
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden