Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

i am a beginning to regard AppleScript. i try to open the xcode project using Xcode. i have succeed to open the folder which contain the xcode project but not yet, the launch of the project using Xcode.any help please ?!

tell application "Finder" to open folder "workpace" of folder "Documents" of folder "user1" of folder "Users" of disk "Macintosh HD"
share|improve this question

2 Answers

up vote 0 down vote accepted

You can get file objects from normal paths with POSIX file:

tell application "Finder"
    open POSIX file "/Users/username/Documents/workspace/workspace.xcodeproj"
end tell

This is slightly slower, but it works even if Finder is not responding:

do shell script "open ~/Documents/workspace/workspace.xcodeproj"
share|improve this answer

Your going to want to do something like this...

tell application "Xcode"
    open file "path:to:my:file.xcodeproj"
end tell
share|improve this answer
If the project is already open, there's a few second delay for some reason. activate would also make Xcode frontmost. – Lauri Ranta Apr 23 at 15:45
The delay is no longer then however long it takes for xcode to regularly open the project (by double clicking). You are right about activate, but doesn't open automatically call activate (ie make the window frontmost)? – Atlas Wegman Apr 23 at 15:50
If I run tell app "Xcode" to open "file.xcodeproj" twice, it takes about three seconds the second time, but tell app "Finder" to open "file.xcodeproj" doesn't. Finder's open command and /usr/bin/open do, but not the open commands of applications. – Lauri Ranta Apr 23 at 16:04
Interesting, thanks for the heads up! I'll leave my answer as is and let you keep the proper one. – Atlas Wegman Apr 23 at 16:16

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.