|
"""AppleScript is a language used to accomplish what traditional scripting languages are unable to do: exchange information between applications on a higher level than is possible through plain-text pipes on the command line;"""
Not so. There are plenty of traditional scripting languages with varying levels of Apple event support. Offhand, here's the ones I can think of:
- Perl has long had well developed application scripting support in the shape of Mac::Glue (download) (perl.com article).
- Python also has very good application scripting support that easily gives AppleScript a run for its money; see appscript (note: self-link).
- Late Night Software do a JavaScript OSA component.
- Tcl and Ruby both have basic Apple event support.
- And UserTalk is the granddaddy of them all - AppleScript included - being the first ever scripting language ever to support OSA (ch. 32 of Matt Neuburg's Frontier book).
For example, here's how to get a Finder comment using MacPython+appscript:
#!/usr/bin/pythonw
from appscript import *
path = '/Users/NAME/your/path/here'
comment = app('Finder').items[path.replace('/', ':')].comment.get()
HTH
has
p.s. Your apachecomments.zip file is broken. Old-style applets store their script in the resource fork, so you'll need to use a compression format that preserves this.
|
osascriptinstead ofapplescript. Can you use JavaScript to write OSAScripts that work interact with AppleEvents ? Absolutely. So to be completely correct I should've used the term "OSAScript-aware languages and extensions can be used to accomplish..." instead of "AppleScript can be used to accomplish..." My bad.The projects that you mentioned above are exactly what I was referring to when I wrote "However, the HFS(+) filesystem also uses resource forks to store metadata for files, which 'traditional' languages can't access without special methods."
There comes a point where a line has to be drawn that separates what will and won't be covered in a piece of writing; I decided to gloss over those details because I didn't feel they were necessary to the point that I was trying to get across at that stage in the article: that AppleEvents provide a much richer method of passing data back and forth than plain-text streams through standard input/output.
To be really picky, it should be stated that it is ECMAScript that can be used to write OSAScripts, since JavaScript, which technically only lives within web browsers, is merely one implementation of the ECMAScript standard--Flash's ActionScript being another. But is anything gained by going into that extra level of detail? Not really; certainly not enough to justify including the additional information in your comment. Which happens to be the line that you chose to draw.
I would like to thank you for pointing out that information in the Comments section, as it provides a way for the readers (and myself!) to find out more information relating to the topics covered in the article.
As for the broken zip file, it was created using Panther's "Create Archive" command from within the Finder. If you expanded the archive with another tool (such as Stuffit Expander or WinZip), then yes, the resource fork may not be attached to the resulting file. To work around this problem, I've posted a copy of the script in SIT format to:
http://www.fivevoltlogic.com/code/applescript/apachecomments/apachecomments.sitx
My apologies.