Reputation: 990
I have a tedious task that I need to repeat every time I build my iPhone project for sending to non-programmer colleagues: all libraries and headers that I reference outside the project's folder need to be copied into the project folder or a subfolder thereof, so I can zip up the source and pass it on.
I'm aware that you can automate XCode with AppleScript, but I can't for the life of me find any proper documentation of the commands available. If I google XCode AppleScript automation, I just get a bunch of hits on writing AppleScript apps in Xcode.
Any help will be greatly appreciated!
Upvotes: 3
Views: 1272
Reputation: 104698
here's a demo to get you started. since you know how to locate the dictionary, the rest may be easy if you are comfortable using AppleScript:
tell application "Xcode"
-- of course, use your project's name instead of Alias
set projectName to "Alias"
set xcProject to project projectName
repeat with idx from 1 to the count of (get every file reference of xcProject)
set fileRef to (file reference idx) of xcProject
get path of fileRef
get id of fileRef
get name of fileRef
get properties of fileRef
set newPath to path of fileRef
-- add logic and alterations here
set path of fileRef to newPath
-- ...
end repeat
end tell
Upvotes: 3
Reputation: 104698
based on your description, it would be easier to create a custom target in xcode to perform this task. xcode can run all sorts of unix utilities for copying, zipping, etc. soo... shell scripting should be much easier. you can also set this target up as a dependency if you'd like, so it always stays up to date (but a little slow for regular development, tbh.
yeah, you can use applescript with xcode in many cases, but it is going to be much more difficult for the task you've outlined.
Upvotes: 1