views:

50

answers:

1

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 the 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.)

+2  A: 

.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.

cdespinosa
That explains it. I had this vague memory of things being different in XCode 2.5 and 3.0
Warren P
Does that also mean that the AppleScript+COCOA style .app bundles built with APpleScriptStudio are obsolete?
Warren P
The AS editor control is still there (it's used by AppleScriptObjC now), but for whatever reason Xcode 3.2 doesn't support .scpt file associations. Not that .scpt files were ever used directly by ASS/ASOC (both use uncompiled .applescript files), but they have legitimate uses. If using an external editor doesn't float your boat, you could always try filing a feature request/bug report on Xcode.
has