I had a weird problem, where I opened up a source code project for Xcode (probably version 2 or earlier) in Xcode 3.1.2, and when I clicked on apple script (.scpt) files that are part of the project it displayed them inside th开发者_高级运维e Xcode editor as if they were source code files, but showed them as gibberish.
When I right clicked and used Get Info, I could see that the encoding and file types were blank (not set up). I removed the .scpt files and re-added them to the Xcode project. Now they show up, and I don't get garbage in the Xcode built-in editor, but I have to click once, and then again, to launch the Script Editor tool, which seems to be the only way to view and edit these.
Questions:
(1) Are .scpt files some kind of binary thing? (I'm new to applescript and Xcode). If so, is there a way to convert them to plain text and still have them work for their intended purpose (be executed as apple scripts)?
(2) Is Xcode behaving properly? Did I solve this problem correctly? (Remove and re-add seems to have made it fix its confusion over filetype and encoding.)
.scpt files are compiled script files. The Script Editor can decompile them into formatted text, and recompile them back into compiled scripts.
(The uncompiled form of AppleScript text has the extension .applescript)
Versions of Xcode prior to Xcode 3.2 had an extension called AppleScript Studio that (among other things) added an AppleScript editor to the Xcode IDE. This was removed in Xcode 3.2, so you now must use the external AppleScript Editor to edit AppleScript compiled script files.
精彩评论