PDA

View Full Version : A new post: Applescript


prestigerg1570@aim.com
2006-10-02, 14:15
How do I learn applescript and is it complex to learn? What is applescript? Obviously the name gives you an idea that it's a programming language, but is it like VB for macs?

Fahrenheit
2006-10-02, 14:17
Basics of Applescript, and background:
http://en.wikipedia.org/wiki/AppleScript

Applescript Studio:
http://www.apple.com/applescript/studio/

A forum you could go to:
http://bbs.applescript.net/

revolution
2006-10-02, 14:18
A quick google brings up many things. I don't personally know how to do it, but there looks to be some fairly comprehensive stuff. As said in the other thread, google! Here's one I found that looks to be quite comprehensive!

Wyatt
2006-10-02, 14:19
I'm glad to see you decided to stick around. I promise we're not all pricks, that was just a strange thread. This one, however, is good.

Why, though, do you want to use AppleScript? Is there something specific you want to do, or do you just want an intro to Mac programming? If you just want to develop for the Mac, you should look into Cocoa and Objective-C instead. They allow you much more flexibility in the kind of applications you can create, and they are a very powerful combination.

prestigerg1570@aim.com
2006-10-02, 14:22
I want to learn mac programming and applescript seems like a good start, I want to be able to make programs that are small and distribute them to everyone for free. I am not very good in mathematics however and that's one reason I failed my C++ course two years ago.

Banana
2006-10-02, 14:27
Thought I'd at least mention that VB != Applescript.

Applescript is a scripting language (can't think of a Windows equilivant right now... Would Macros in Excel count?) whereas VB is programming language.

You could go to www.en.wikipedia.org and find out how scripting and programming language differs. Basically scripting are good for doing some kind of repititve tasks and reply on high level function provided by OS whereas programming language has more power and flexibility but requires much more work.

HTH.

Kickaha
2006-10-02, 14:54
Sorry Banana, but I respectfully disagree. The distinction used to be one of compiled-vs-interpreted, but with things like Java running around, it's gotten really fuzzy.

The best definition I've seen yet goes something like:

Programming languages write applications more or less from scratch. The external functionality that you integrate comes in the form of libraries.

Scripting languages tie applications together to do more complex tasks. The external functionality that you integrate comes in the form of applications.

Python is generally seen as a scripting language, for instance, because it is interpreted, but you can write complex apps in it, and never hook together other apps or tools. I'd consider it a programming language.

AppleScript is traditionally also a scripting language, to drive applications and tie them together. However, with things like AppleScript Studio popping up, it's becoming more of a stand-alone language. Carbon Copy Cloner, for instance, is an AS application that is indistinguishable from any other application.

From a theory point of view, it's all moot, since both scripting and programming languages are Turing complete, and mathematically equivalent, it's simply a matter of semantics based around how the external functionality is bundled: libraries, or applications.

julesstoop
2006-10-02, 14:56
Apple script has got an user-friendly front end called "Automator". It might be worthwile to check out.

Kickaha
2006-10-02, 14:59
Automator doesn't have anything to do with AppleScript, sadly, it's Yet Another Hook Infrastructure for apps. :\

Wyatt
2006-10-02, 15:02
But Automator can be used to run AppleScripts.

New guy, are we confusing you yet? :D

Kickaha
2006-10-02, 15:15
But Automator can be used to run AppleScripts.

New guy, are we confusing you yet? :D

Automator can also be used to run shell scripts, Python scripts, Perl scripts, or any other script/program/file you have on your drive. :)

Banana
2006-10-02, 16:41
Sorry Banana, but I respectfully disagree. The distinction used to be one of compiled-vs-interpreted, but with things like Java running around, it's gotten really fuzzy.

OP, aaannnnddd that is why one does background research or you get bushwhacked by a hung-like-a-horse bushman. :D

Kick, apparently I didn't realize that my understanding of scripting language was that dated. I mean, when I go look at Excel macros (you didn't say whether that counts as scripting or not), I can't help but feel well, limited compared to what I can do in VBA which is in turn limited compared to VB .NET, which is in turn limited compared to C++.

Just because someone can write bazillion lines to get around weakness of single language to do something that can be done in one line in another language doesn't make the first language necessarily Turing complete, but hey I'm an ignoramus- what do I know? :p

staph
2006-10-02, 19:13
For what it's worth, Applescript Studio (i.e. Applescript for writing apps with rich user interfaces) isn't that hard to use, although it would be a little bit frustrating to write anything big in due to the extreme simplicity of the Applescript language. But if all you want to do is write a tiny little app as a first step in Mac programming, it should be fine.

If you're looking for something with a VB vibe, you may want to check out RealBasic. It's an object-oriented BASIC development environment for Mac, Linux and Windows, and can even cross-compile for all three platforms. Unfortunately, it costs money, and they still haven't come out with a Universal Binary version yet (although it's promised for this quarter). There's a 30-day trial, so you can at least get your feet wet before you decide to spend the money.

In the long term, if you plan to do larger Mac-only projects, it may well be worth gritting your teeth and learning Objective C/Cocoa. On the plus side, I don't think it's quite as horrible as C++. Kickaha would be better qualified to take you through the differences though.

Kickaha
2006-10-03, 01:30
Kick, apparently I didn't realize that my understanding of scripting language was that dated. I mean, when I go look at Excel macros (you didn't say whether that counts as scripting or not), I can't help but feel well, limited compared to what I can do in VBA which is in turn limited compared to VB .NET, which is in turn limited compared to C++.

Excel macros would be an internal scripting language, ie, macros... actually, I'm curious - I can't recall if they're Turing-complete or not. IIRC, they have for loops, conditionals, variables... looks like it. It's just a language that is confined within a specific application's boundaries.

What you're comparing between the languages is relative levels of abstraction. A higher level of abstraction makes complex things easier, but it doesn't add any intrinsic capabilities that wouldn't be possible in a lower language.

Just because someone can write bazillion lines to get around weakness of single language to do something that can be done in one line in another language doesn't make the first language necessarily Turing complete, but hey I'm an ignoramus- what do I know? :p

You'd be shocked at how little is needed to make a language Turing-complete. :) (Hint: assembly languages are Turing-complete.)

Automator scripts? Not Turing-complete. No branching. AppleScript? Turing-complete. Anything you can do in C++, Java, C, Pascal, Basic, Fortran, APL, PL/1, Perl, Python or Cobol, can be done in AppleScript. ;)

Banana
2006-10-03, 05:51
Just realized that my second quoted statement, Just because someone can write bazillion lines to get around weakness of single language to do something that can be done in one line in another language doesn't make the first language necessarily Turing complete, but hey I'm an ignoramus- what do I know? ... didn't convery what I was thinking.

When I said that first language isn't Turing-complete, I was thinking more like it's not *as* Turing-complete compared to the second language; or put it in other way, second language meets the criterion for Turing-completeness much better than first language, even though both satisfy the necessary condition of Turing-complete.

Is that still inaccurate? ;)

staph
2006-10-03, 06:46
Yes, because something is either Turing complete or it isn't. Once it's Turing complete, you can't really talk about degrees of Turing-completion. Have a look at the Wikipedia article (http://en.wikipedia.org/wiki/Turing_complete).

Having said that, there's a big leap from "Turing complete" to "usable as a programming language for complicated modern applications", which I think is more what you're getting at.

Kickaha
2006-10-03, 09:51
Indeed, and that's where the levels of abstraction comes in. While you can replicate anything from Java in straight assembly (obviously, otherwise you'd never be able to run the Java code on a chip), doing so would be painful.