Is there any way to create a duplicate of target using AppleScript. I am using below code but it shows Error : Xcode got an error: Targets can not be copied.
tell application "Xcode"
tell active workspace document
set firstProject to (get first project)
set firstTarget to (get second target of firstProject)
tell application "Xcode" to duplicate firstTarget
end tell
end tell
above scripts is for the project that is currently open in Xcode.
I have different approach to achieve it but not getting how to make it work.
Open an Xcode project
tell application "Finder" open POSIX file "/Users/TestUser/Desktop/CoBranding/source/tet/test.xcodeproj" end tell
Choose a particular target and and select it (keep focus on it)
tell application "Xcode" tell active workspace document set firstProject to (get first project) set projectDirectory to (get project directory of firstProject)
end tell end tellNow press Duplicate under Edit menu using system events of Apple Scripts.