Re: target duplication with AppleScript
Re: target duplication with AppleScript
- Subject: Re: target duplication with AppleScript
- From: Dmitry Markman <email@hidden>
- Date: Sun, 24 May 2009 07:43:19 -0400
Hi Phiip thank you very much for your code
I was thinking to use "System Events" as last resort, especially for my first question where I need to change target parameters (Custom build tool target)
duplication target I can achieve with the following lines
tell my_project set make_target to target template "Other/External Target" set my_new_target to make new target with data make_target with properties {name:target_name} end tell
I'm already using System event for setting some checkboxes in executable properties dialog
thank you very much for your code it really helped
dm
On May 24, 2009, at 4:17 AM, Philip Aker wrote: 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