Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Scripting adding files to a project



There are two ways you can specify where to make a new object. First, you can use a location specifier; for example:
make new foo at end of group bar
make new foo before file reference 2 of bar
etc


Second, you can use a tell block on the container:
tell group bar
	make new foo
end

Saying "make new foo at group bar" does not presently work, at least in cocoa scripting.

	- Rick

On Oct 25, 2005, at 3:58 PM, Nathan Herring wrote:

I didn't have the "end of (file references) of" in there; I will try it
with that. Does the "at" parameter generally require you to specify the
beginning|end of the element section you're using? (or "before file
reference ID #####"?)


-nh

-----Original Message-----
From: Rick Ballard [mailto:email@hidden]
Sent: Tuesday, October 25, 2005 3:47 PM
To: Nathan Herring
Cc: email@hidden
Subject: Re: Scripting adding files to a project

On Oct 25, 2005, at 9:57 AM, Nathan Herring wrote:

Does anyone have a working script that allows you to create new file
references and assign them to various targets? My attempts have met
with
silent failure: no error reported, and no files added.

Sure; try something like this:

tell application "Xcode"
	tell project "MyProject"
		set newFileRef to make new file reference with
properties
{name:"foo.m", full path:"/tmp/foo.m"} at end of (file references) of
group "A Source Group"
		add newFileRef to target "MyTarget"
	end tell
end tell

I'd be interested to see what you were trying that didn't work; if it
wasn't correct, it probably should have given you an error.

I hope this helps.

- Rick

_______________________________________________ Do not post admin requests to the list. They will be ignored. Xcode-users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/xcode-users/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.