• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Using AppleScript to access a Copy File Phase in an Xcode project
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using AppleScript to access a Copy File Phase in an Xcode project


  • Subject: Re: Using AppleScript to access a Copy File Phase in an Xcode project
  • From: Dave McCaldon <email@hidden>
  • Date: Wed, 21 Sep 2005 14:37:30 -0400


Thanks for the help, I almost have it working now.  I'm getting what is probably a regular AppleScript error, but I'm just not [yet] familiar enough with AppleScript to figure it out:

"Xcode got an error: Can't make file reference (item 2 of every file reference of project "Test") into type reference."

The line of code in question is:

        add file reference aFile to aCopy

Where aCopy is a Copy Files Phase that I created like this:

            tell aTarget
                set aCopy to make new copy files phase with properties {destination directory:wrapper, path:"Headers/" & aDir, run only when installing:false, comment:""}
            end tell

And aFile came from enumerating items in the project:

        repeat with aFile in every file reference of aProject

I tried passing (a reference to aFile) and also making a copy of aFile with the copy command (e.g. copy aFile to aFileCopy) and then inserting that, but I get pretty much the same error, except it can't make the copied object into a reference.

Any ideas?

Thanks!




On Sep 21, 2005, at 1:03 PM, Gouri jonnalagadda wrote:


On Sep 21, 2005, at 9:07 AM, Dave McCaldon wrote:


I can actually determine what I need from the destination directory and path of the cfbp elements.

Thanks for the info on properties of, that's exactly what I've been looking for!

Now I need to find out how to insert a new cfbp element!


I am not sure if this is what you are looking for, but here are some pointers which might help you.  This is only supported in Xcode 2.1 though...:

- If  you are trying to copy a file from within the project into the copy files build phase of a target, then the following  should work:
tell application "Xcode"
    tell project "cocoTargetSuiteTest"
        add file reference "main.m" to build phase 1 of target 1
        get name of every build file of build phase 1 of target 1
    end tell
end tell

- Presently you CANNOT add a file to a build phase unless it is present in the project.

- To add a file to a project from another location something like this should work:
set test to (choose file)
set testPath to POSIX file (POSIX path of test)
tell application "Xcode"
    tell project 1
        tell group "resources"
            make new file reference with properties {full path:POSIX path of test, name:name of (info for testPath)}
        end tell
    end tell
end tell


Gouri





 _______________________________________________
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

References: 
 >Using AppleScript to access a Copy File Phase in an Xcode project (From: Dave McCaldon <email@hidden>)
 >Re: Using AppleScript to access a Copy File Phase in an Xcode project (From: Daniel Jalkut <email@hidden>)
 >Re: Using AppleScript to access a Copy File Phase in an Xcode project (From: Dave McCaldon <email@hidden>)
 >Re: Using AppleScript to access a Copy File Phase in an Xcode project (From: Gouri jonnalagadda <email@hidden>)

  • Prev by Date: Re: Help porting from codewarrior?
  • Next by Date: Re: Help porting from codewarrior?
  • Previous by thread: Re: Using AppleScript to access a Copy File Phase in an Xcode project
  • Next by thread: Re: Using AppleScript to access a Copy File Phase in an Xcode project
  • Index(es):
    • Date
    • Thread