Author Topic: Lesson #1.1 : What do you need?  (Read 3371 times)

0 Members and 1 Guest are viewing this topic.

Offline Publi-Script

  • Administrator
  • Hero Member
  • *****
  • Posts: 596
  • Karma: 16
  • Gender: Male
  • Automate your Life!
Lesson #1.1 : What do you need?
« on: May 04, 2007, 02:07:41 PM »

1.1 What do you need?

AppleScript’s requirements are not that extensive. On a “physical” level, you need a Macintosh computer (duh!). Each Mac comes with AppleScript pre-installed and this for as far back as Mac OS 7.1.1 (Oct. 1993). Your “Applications” folder should contain a folder named “AppleScript”. In this folder you will find the following items:

  • AppleScript Utility: Used to set the default Script Editor, enable GUI (Graphic User Interface) scripting, setting up Folder Actions and displaying the Script menu.
  • Example Scripts: Some script provided by Apple
  • Folder Action Setup: An utility that help you setup Folder Actions (Script attached to a folder that operate on item you move to that folder)
  • Script Editor: Your default and FREE script editor.

Later on, you will be able to use another Apple freebie: AppleScript Studio (part of Xcode). This much more “involved” editor will enabled you to code just about everything for the Mac platform using languages like, C++, Java, Objective-C, AppleScript, etc. This suite will also enable you to create much more complex Dialogs and user interface. Xcode can be installed from your MacOS install DVD or downloaded directly from the Apple website.

On a personal level, you must possess a minimum of logic and mathematical skills, a great deal of curiousness and a fair amount of abstract thinking. I said it once, I will say it again, programming is not for everyone just like selling is not for everyone  and plumbing is not for everyone. That is not meant to put people down but to each his own.

Lastly, you will need a “reason” for scripting. Normally this comes out of the need to render repetitive tasks more bearable. Let’s face it, the advent of computer was meant to alleviate such task but if you come right down to it, it doesn’t in many cases.

So let’s begin by setting up your ApplesScript preferences. For this you will launch your AppleScript Utility mentioned above.

  • Default Script Editor: Leave it as the default, Script Editor, for now. Yes, this does imply that other script editors are available to you.
  • GUI Scripting: I would recommend activating this. You will soon find that not all functions of a "scriptable application" can be acessed through AppleScript. You will often have to bypass this by “Scripting the UI” or in clearer terms simulate the mouse movements and clicks as well as other Graphical User Interface objects.
  • Folder Actions: We will leave that one be for now but will return later
  • Show Script Menu in menu bar:  As you check this box you will see a small “script icon” appear to the right of your menu bar. This menu will give you a quick access to your scripts in whatever application you happen to be at the time. It can also display “application specific” scripts again tied into your current application.
  • Show Library scripts: Your OS was installed with a bunch of scripts located in your Library folder. Toggling this option will display (or not) these scripts in your “AppleScript Menu”.
  • Show application scripts at: This one allows you to either display “Application Specifics” at the top or bottom or your script menu.

Note: To add “application specific” scripts into your AS Menu (far right), you need to add an “Applications” folder inside your “User Script Folder” (accessible through the AS Menu). In this folder you will need to add folders named after the “targeted” applications.

AppleScript Utility

AS Menu

Well, I believe this concludes our first lesson, come back shortly for the “Environment” lessons where we will take a look at Apple’s Script Editor and what can be done with it. In the meantime, feel free to ask your question or post your comments about this lesson.

« Last Edit: May 07, 2007, 10:27:23 PM by Publi-Script »
Michel Lemieux
Forum Administrator
OS X 10.6.4
Quark 6.5 / 7.5 / 8.1.6
Adobe Design Premium CS / CS2 / CS3 / CS4 / CS5
Script Debugger 4.5

Offline Emma

  • Full Member
  • ***
  • Posts: 205
  • Karma: 9
Re: Lesson #1.1 : What do you need?
« Reply #1 on: May 05, 2007, 05:20:47 AM »
Well, I for one had never launch AppleScript utility before today! I've never dabbled in GUI scripting, and if I'd tried I wouldn't have been able to, so now it's enabled and that's a good start!
Quark 6.5
OS X 10.4.8