I’m trying to make a script that duplicates a target in xcode, rename the new target, and change values inside that target. I’m currently stuck with renaming the target and changing the values inside. How do I do this?
Currently, I am trying to use
tell application "System Events" to open myProject
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 myOldName)
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
keystroke 5 using control down
button click "Rename"
end tell
After renaming, I need to change the old values to new ones inside the target (when you double click a target for example, change info.plist file value from old info.plist to new info.plist) I really don’t know how to go about this.
Any help will be very much appreciated.
Thanks.