Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the '10.5: Create executable command-line AppleScripts' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.5: Create executable command-line AppleScripts
Authored by: mjb on Nov 13, '07 12:33:20PM
As robg said, you don't have to use .sh as an extension. And in fact, you shouldn't.

In the unix world, an extension on an executable is intended only to show what type of content the executable is, and .sh indicates that the executable is a script written in shell code (/bin/sh).

There are many different extensions in use, but there are no hard and fast rules.. .pl is usually perl, .py is python, etc. For applescript you could use .as, or even leave the extension off all together.

[ Reply to This | # ]

Standard is ".scpt"
Authored by: Anonymous on Nov 13, '07 12:56:11PM
A moment of research shows there's already a standard for this, so please use it.

From the man page for osascript:

NAME
     osascript -- execute AppleScripts and other OSA language scripts
Notice that this isn't just for Applescript.

The man page gives examples of script files with ".scpt" extensions. Please use that.

[ Reply to This | # ]

Standard is ".scpt"
Authored by: adrianm on Nov 13, '07 10:59:24PM

Not really, .scpt is what Script Editor uses when saving as a 'script.'

If anything, you should use .applescript as that is what Script Editor uses by default when saving apple scripts as text.

But the first responder was correct in that one shouldn't really use an extension at all.



---
~/.sig: not found



[ Reply to This | # ]
10.5: Create executable command-line AppleScripts
Authored by: jubalkessler on Feb 11, '09 01:53:11PM

I completely disagree with any suggestions of leaving off a file extension for OSA scripts. Let me put it this way. When viewing files on the commandline -- or even in Finder view -- it's impossible to tell what kind of script it is unless (a) it's been typed by the OS via type/creator codes, which is deprecated IIRC, and (b) file extensions. One could also look inside the file, but that's tedious on a large scale.

So if I'm looking at ten or twenty scripts, half of which are Bourne shell (.sh) and the other OSA, then I definitely want to differentiate based on filename.

There's nothing wrong with using filename extensions, and it's good practice to use ones that are commonly agreed (as much as possible, anyway) to represent, and only represent, AppleScript scripts.

So perhaps .scpt after all.



[ Reply to This | # ]