Domain: latenightsw.com
Stories and comments across the archive that link to latenightsw.com.
Comments · 12
-
HyperCard lives on in every AppleScript
What I'd really like to see is a merging of the capabilities of system level and interface level scripting languages. The interface guys are all in AJAX-y Javascript land, while system-level scripting (at least on a Mac) is through AppleScript -- HyperTalk for the OS -- and well-formed apps. Reintegration would be awesome.
Remember this? http://www.latenightsw.com/freeware/JavaScriptOSA/
App Store and iPhone locking notwithstanding, I don't think it's a nefarious user-cannot-be-developer intent (though I'm sure many Slashdotters will disagree), I think it's simply where the market went and Apple's over-extension got the better of it.
-
Re:Python
-
Re:I have one question to those proficient in ASYou must be psychic. Applescript is an implementation of the Open Scripting Architecture (OSA) API.
There's a scripting component for Python called OSA Python, and one for Javascript called Javascript OSA.
Frontier's UserTalk language is another implementation. -
AppleScript and Perl
AppleScript had the concept of "dialects" which were AppleScript terms written in different languages (they had French, Japanese, Japanese (romanji), German, and Italian working). It was intriguing, I remember actually submitting an AppleScript in French for an assignment in French class in high school circa 1995.
English:
the first character of every word whose style is bold
French:
le premier caractère de tous les mots dont style est gras
Sample of an AppleScript in English and Japanese
Some discussion on it circa 1994
Note, this should not be confused with OSA (Open Scripting Architecture) dialects, like JavascriptOSA, which are different.
Aside from this, the most linguistically extendable language would probably be Perl (especially Perl 6). Having been written by a linguist, I imagine the most awareness of the linguistic aspects of coding in a different lanugage would be.
I mean really, "coding in another language" doesn't mean replacing "for" loops with "pour" loops, it means taking advantage of concepts (like word genders and verb conjugation) that are specific to that language. Programming "in a French way" could lead to constructs, algorithms, and phrasing very different from "standard C".
-
Re:Why use a GUI when you can run an itunes scriptOh man, you are SO right. The script was a pain in the ass to write, let me tell you. But you can install an OSA to use Javascript instead of AppleScript. It's at least marginally better.
P.S. O'Reilly's Applescript book is the shiznit.
-
Re:Somewhat off topic but...
So you're not restricted to using AppleScript to get those benefits.
And in fact, the OSA is more than a theoretical possibility. There's a free Javascript OSA module available...use Script Editor to control your mac using Javascript!
-
Re:Somewhat off topic but...Applescript is an application scripting language. I sure there is YACC/LEX code floating around for the language. So in theory it wouldn't be that hard to port.
Python, Perl and to a lesser extent Javascript aren't designed for this. (I say lesser extent Javascript, since there actually is a version of Javascript that compiles to the same format Applescript uses and works in the same way)
One must also point out that there are glue modules for Perl that allow it to do most Applescripting.
Applescript Module
Applescript Glue for PerlI agree that in general one would be better off using an other scripting language. But Applescript is useful -- especially for small tasks. (I think the majority of my scripts are less than 25 lines long)
I've not tried using the more robust OSA features in Python. Ususally I just call applescripts. I plan on doing more of this during the upcoming weeks.
Unfortunately as I alluded in my other post, Applescript Studio doesn't really support OSA languages other than Applescript. (OSA is from a programmer's perspective something like the VM for Java - it lets you use other languages)
I 100% agree that having a good general scripting book for OSX would be a great idea. It would have to be very practical. Here's hoping.
-
Re:Gnome and KDE are more or less the same these d
Scriptability: You mention AppleScript, and claims it is like having shellscript for GUI. No it isn't: you are bound to use that specific language. They could easily have supplied a network protocol (like KDE's DCOP) or any other more generic interface. Since they didn't, everything has to go to this dreadful language. Any experienced programmer would instantly fear "an easy-to-use, approachable, English-like language".
Way to do your research, lil buddy.
The AppleScript system is open. In fact, AppleScript just happens to be the default language Apple gives you to use within their "Open Script Architecture" (OSA).
For example, you could use JavaScript to tie into all the hooks AppleScript can. There is an older list of other OSA languages available as well.
As an experienced programmer, I find AppleScript useful. When I'm scripting a bunch of Mac apps, the english-ness and gimpy-ness of AppleScript has never bothered me. Why? Because I'm not doing any "real" work. If I'd like to do a combination of "real" work and scripting apps, I could easily use a language from the above list, or call the script events from C or a C module access by a real language. -
Re:What's it for...
My guess is that over time Apple wil make Javascript an equal MacOS X scripting system, alongside Applescript
JavaScript has always been a Mac OS X scripting system, alongside AppleScript, but it has to be installed separately.you can download it from Late Night Software.
O'Reilly Net had a tutorial on scripting applications with JavaScript.
-
Re:What's it for...
By the way, JavaScript is already available as a peer of the AppleScript language, using JavaScript OSA. That's why it's called the Open Scripting Architecture
:). -
Useful on Darwin/OSX?JavaScript OSA for MacOS seems like it might be something similar:
JavaScript OSA is a port of the Mozilla JavaScript 1.5 scripting system to the Macintosh in the form of a OSA (Open Scripting Architecture) component. You can use JavaScript OSA as a scripting language in any Macintosh application supporting OSA languages, such as the Script Editor included with the MacOS or our own Script Debugger product.
Though not necessarily made with "weblications" in mind, you could probably produce a full featured application using this AppleScript component (such as by making calls to a Unix shell or via XML-RPC and SOAP calls implemented in OSX 10.1). My question is, would a Darwin/OSX port of SashXB be more or less useful than just using JavaScript OSA for a system-level JavaScript API?
-
MacOS has had this for yearsSeriously, through Apple's Open Scripting Architecture folks have been able to use any number of languages such a Tcl/Tk. Java, Perl, Python, Jpython, and JavaScript under MacOS & MacOS X.
The great thing is that virtually every Mac application has hooks for scripting through the standard Apple Events model which is automagically available to all other OSA languages.