• 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: adding file reference via applescript
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: adding file reference via applescript


  • Subject: Re: adding file reference via applescript
  • From: Dmitry Markman <email@hidden>
  • Date: Thu, 17 Nov 2005 00:36:25 -0500

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:
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>)

  • Prev by Date: (no subject)
  • Next by Date: Re: (no subject)
  • Previous by thread: Re: adding file reference via applescript
  • Next by thread: Re: adding file reference via applescript
  • Index(es):
    • Date
    • Thread