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: adding file reference via applescript



thanks for the answer
I'm not sure I understand your second suggestion:
"or give you file references a file extension that corresponds to their file kind (e.g. '.cpp' for a c++ file)."


file reference has a name as file itself (so it has cpp extensions)
I didn't find property extensions for the class file reference
I added rule in the target
that file that matches  *.cpp pattern should be compiled with gcc3.3

but when I called the command

tell new_group
set new_file to make new file reference with properties {file kind:"sourcecode.cpp.cpp", name:file_name, file encoding:macos roman, full path:full_file_path, path:file_name, target:simulink_target}
end tell


new file reference is created and was put into the new group as expected
but it wasn't added to the target (I have only one target)
I tried to do something like that:

tell application "XCode"
	set my_targets to targets of my_project
	set s_target to item 1 of my_targets
	set compile_phase to compile sources phase of s_target
....
	add new_file to s_target
end tell

in that case file references will be added to the copy phase (it target has one if there isn't copy target nothing will happen)

I tried the following too


tell compile_phase
make new build file with properties {file reference:new_file, target:s_target, build phase:compile_phase, name:file_name}
end tell


I tried few variances of that but I'm always getting AppleScript error


BUT while I was writing that mail I found interesting thing

1. script doesn't calls
	add new_file to s_target
2. script close the project
3. script opens project again and calls add new_file to s_target
and then file was added to the right build phase

thanks


On Nov 16, 2005, at 2:41 PM, Rick Ballard wrote:

Xcode colorizes files based on their file kind, so for now you'll need to either manually set the file kind on your file references or give you file references a file extension that corresponds to their file kind (e.g. '.cpp' for a c++ file).

Dmitry Markman

_______________________________________________
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
References: 
 >adding file reference via applescript (From: Dmitry Markman <email@hidden>)
 >Re: adding file reference via applescript (From: Rick Ballard <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.