TweetFollow Us on Twitter

Applescript 4 NetAdmin

Volume Number: 15 (1999)
Issue Number: 8
Column Tag: Network Administration

AppleScript for Network Administrators

by Russ Coffman
Edited by Todd Staufer, Technical Edit by Cal Simone

Getting Started

Introduction

You may have programmed in BASIC, HyperCard, or C, or not at all. I had done all that plus used UserLand's Frontier scripting system, but for some reason, I was slow to get into AppleScript. Now I can't stop. If you have thought of getting into AppleScripting but haven't yet, here are some reasons and ways to get started, especially if you are a network administrator.

Like anything, motivation is important in learning. It helps to have a particular problem in mind before starting. But that requires knowing what AppleScript can do. That turns out to be a lot. For a quick start on its capabilities, visit Apple's AppleScript web page at http://www.apple.com/applescript/

Luckily, there are almost limitless applications for network administrators within the scope of AppleScript. Here are a few simple ones I found when starting off:

  • Simple but tedious tasks. An early script I wrote just deleted the contents of folders on file servers used for backups. Users would drag files to be backed up to their backup folder, but that tended to fill up the server (since replaced with G3s). Opening each folder, selecting all the items in the folder, and dragging them to the Trash was tedious. AppleScript can process all folders in one drag and drop. This was a simple script, but did the job.
  • Repetitive tasks. Another simple script opened 1800 WordPerfect documents and saved them as plain text files for input into an archiving and indexing system. Sounds easy, but getting footnotes out too required some tricks. Several days of manual labor was done in a few hours, error-free.
  • Cleaning up after an install, or doing complete installs. A lot of software can be safely drag-installed -usually faster than running an installer, plus you can make new aliases in the Apple menu, save and restore user files to the right place, and in general customize the installation to your users' needs. System installs often install unneeded files - use scripts to keep your System Folders lean and clean.
  • Periodic operations. Examples are backing up an important file or folder, or watching for some network condition and being alerted to it. We had a problem with our 4-Sight fax server application dying. Luckily it was scriptable (but the documentation and scripting addition are hidden on one of the install disks), and had a command that would just say "I'm here." A stay-open applet (a script application that doesn't quit after executing) polls it periodically and alerts me if it does not get a response.

Get Motivated to Learn AppleScript

Those are some general uses for AppleScript, well within its capabilities, and good learning exercises. Think of your shop and identify potential applications. Start with at least one real problem and keep it in mind as you learn: this will be Your First Script.

Now, how do you go about learning AppleScript? Learning AppleScript is much like learning to play the trombone. The best way to learn the trombone is to play the trombone. The best way to learn AppleScript is to write scripts! But there's still the "getting started" thing. You've got your real world problem defined - a big step. Solve that problem and you've got some positive feedback - "I can do this!" From then on, you'll never want to stop AppleScripting. The upside is that AppleScripting is much less annoying to others than playing the trombone. It might even get you a raise, or even a new career. It certainly looks good on your résumé.

Getting Started

You don't need much to get started. Apple's Script Editor is included with every Mac. If you plan to get gung-ho with AppleScript, you may want to invest early on in an editor/debugger, such as Main Event's Scripter®, or Late Night Software's Script Debugger. Both of these tools let you step through scripts one command at a time, see the result of each command, watch variables change, and much more. You need two more things to get started: a good book and a good learning environment.

Get a book (or better, several books) on AppleScript. Like many people, I started with Danny Goodman's AppleScript Handbook, now in print again, but somewhat out of date. No matter, it's a good intro. See the list of reference material at the end of this article for more good books. Whichever book you choose, be determined to start at page one and work to the end, skipping nothing.

Do all the examples and exercises. It's important to type in the examples, don't just load them from a disk if one is provided. The exercise of typing in a script makes you think through what you are doing. Soon you'll notice you can anticipate what's next without even looking at the next line - you'll go into "auto-complete" mode! Trust me on this, it works. Just watch for for that "I can do this" light bulb to light up above your now-swelled head.

People learn best in different ways. You may do best by setting aside an hour a day with a goal of getting through one chapter or one exercise in that hour. Others, like me, do best with total immersion - at least four uninterrupted hours of study with no distractions. Have an AppleScript Weekend. Decide on a regimen that has worked for you and stick to it. Have plenty of water, coffee, Jolt Cola, and snacks available. You want to be way up on Maslow's Pyramid so you can concentrate on AppleScript. Set the mood to what works for you, from total silence to MTV.

Example Scripts

Now let's look at a few scripts. Even if you are new to AppleScript, you'll find it literal enough to follow along. To help, in the scripts below I've added "comments," indicated by a double dash:

- my comment blah blah.

First, let's look at deleting the contents of folders dropped on an AppleScript droplet (As mentioned, an "applet" is a script saved as an application that acts like a real application. The script can run when double-clicked and it can receive and handle messages sent from other applications and scripts. It can also process items dropped on its icon in the Finder - if so, it's a "droplet"):

on open fileList
-sets the variable fileList to a list of folders dropped

Any AppleScript applet becomes "droppable" in the Finder just by including an "on open" handler (a handler in AppleScript is the equivalent of a procedure, function, or subroutine in other languages - a starting point for a block of commands). In AppleScript, a handler can respond to a message from another application, in this case, the "open" handler responds to "open" messages sent from the Finder. A list of references to files, folders, or disks you drop are passed to a variable, in this case fileList. A list in AppleScript is a one-dimensional array of the form {item 1, item 2...item n}, where the items can be any type of object - text, numbers, references to files, even other lists. The "lazy L" character ¬ (type Option-L) is a command continuation character that lets you break up long lines for better readability.

Next, since we're talking about deleting files, let's ask if we really want do to this:

Display confirmation dialog
  display dialog ¬
    "Do you really want to delete the files in the 
      selected folders?" ¬
    buttons {"Delete Files", "Quit"} default button 
      2 with icon stop
  if the button returned of the result = "Quit" then return
-quit, doing nothing

Otherwise, let's process the folders. The application that deletes files is the Finder, so we want to tell the Finder to do the work. The script does just that with a "tell" command. All statements between the "tell..." and "end tell" commands are directed to the application named in the "tell" command:

  tell application "Finder"
-next commands "talk" to the Finder

AppleScript has a special form of the repeat loop that processes items in lists in sequence - a handy and often-used feature. Each time though the loop, the variable myFolder will be set to the next item in the loop until the last item is processed:

Sequence through a folder

    repeat with myFolder in fileList
-sets myFolder to each folder in the filelist
      delete every item in myFolder
-use of "every" saves using an inner loop
    end repeat
  end tell
end open

Now let's take a look at a quick script for automating a drag-install. This is a great one for labs, retail computer stores and other situations where you might, after a while, get sick of manually installing files that get moved by users. This script replaces just the application named "Premise" in its folder, assuming other items do not need updating:

Drag-install automation script

tell application "Finder" activate  if the disk ¬
  "Old Bailey" exists then
-is the server containing the file up? 

First, a sanity check - is everything in the right place? Then, copy the file, replacing the old file without asking first.

if the folder "West Group Research" of the folder ¬ 
"Applications" of the startup disk exists then
    duplicate the file ¬
"Old Bailey:Premise Install:West Group Research:PREMISE"¬
  to the folder "West Group Research" of the folder ¬
  "Applications" of the startup disk with replacing

Delete the old alias in the Apple menu, using a construct that will find the alias we want even if the user has added a leading character to change the sort order - a common occurrence. That's the kind of real world stuff you'll learn to write scripts for. Finish up by making a new alias:

      delete (every file of the apple menu items folder ¬
        of the startup disk whose name contains "Premise")
      - pretty literal, huh?
      make new alias file at the apple menu items folder ¬
        to the file "Premise" of the folder ¬
        "West Group Research" of the folder ¬
        "Applications" of the startup disk
    else
      -- the target folder probably moved
      display dialog "Can't find Premise folder." ¬
      buttons "Quit" default button 1 with icon stop
      return
        -quits and closes the script
    end if
  else
    -couldn't find the file server
    display dialog "Old Bailey not mounted." buttons "Quit" ¬
default button 1 with icon stop
    return
  end if
    -quits and closes the script
end tell
beep
-we're done

That was easy, wasn't it? A more elaborate script does an install of all files required if a complete update or first-time install is needed. I use this premise for the basis of a more elaborate script in my work, which does a number of things. My more elaborate version:

  1. Moves any non-standard (user) files in Premise's folder to the Desktop.
  2. Replaces the entire Premise folder.
  3. Deletes old preferences and adds new Preferences Folder items.
  4. Restores user items to the new application folder from the Desktop.
  5. Makes a new alias in the Desktop menu after deleting any existing alias.
  6. Adds one extension and deletes the old version if present.

And it does all this in a fraction of the time it takes to use the installer, all with just a double-click. Whew! (Sometimes it's good to hire lazy people because they'll find an easier way of doing things. But don't quote me on that.)

A Periodic Script

Now for a periodic script, one that stays open, once launched, and performs a task periodically. The key here is the idle handler. The "idle" message is sent to a script application by the system at an interval you can specify:

A Periodic Script

-bring the Finder to the front after launch to be user-friendly:
tell application "Finder" to activate
-we start here each time the system sends us the idle message:
on idle

Parts of the next command (the Network Address and Pick Server commands) come from an AppleScript scripting addition - a file that adds additional commands to AppleScript's repertoire (more on scripting additions later). This one came with 4-Sight Fax, and lets us check to see if the fax server application is alive:

  set z to Network Address of  ¬ 
    (Pick Server using "Pony Express" without picker)
  if z is 0 then
    -if a zero is returned, the server isn't up
    beep
    activate
      -bring this script to the front
    display dialog "Fax server is down!" buttons ¬
    {"OK", "Try Again"} default button 2 with icon caution

MISSING FIG 1!
Figure 1. AppleScript's display dialog command makes simple dialogs - all you need in many cases. You can specify the icon and the default button, and have from one to three buttons. Another form of this command asks the user to enter text, which you can then pass to your script.

The Pick Server command tends to gets a lot of false alarms - the server is not down, just busy when we called, so we'll wait a second and try again. Notice you can determine what button was pushed and take different paths of action:

    if the button returned of the result is "Try Again" then
      -try again, obviously
      set z to the Network Address of¬
        (Pick Server using "Pony Express" without picker)
      if z is 0 then
        display dialog "2nd check: Fax server is down!" ¬
        buttons {"OK"} default button 1 with icon caution
      end if
    end if
  end if
  return 60
  -the "60" tells the system to send the idle message again in 60 seconds 
  -this saves a lot of CPU time
end idle

This simple, easy technique can be used to check for almost any condition and alert you if necessary. Most email applications are scriptable these days, and there are even pager systems available, so you could elect to be notified by those methods as well.

Get (More) Info

In that last example, we had to use a new command that came from an AppleScript scripting addition. One amazing feature of AppleScript is its extensibility through the scripting addition, also known as an OSAX (Open Scripting Architecture eXtension; plural form: OSAXen). Apple includes some, but there are hundreds of freeware, shareware, and commercial scripting additions available. These add functionality such as list and text manipulation, higher math, better dialogs and other users interface features, and too many other commands to even begin to list. Start collecting and reviewing these -they can be big timesavers.

That said, heed this warning: Don't just install every scripting addition you can get your hands on. Eventually you will run into "terminology conflicts" where the terminology of a scripting addition will conflict with that of an application or another scripting addition. (More on terminologies below.)

Of particular interest to network administrators is Akua Sweets, available on the Info-Mac HyperArchive. With this scripting addition, you can gather network information, more easily control remote machines, display text information, create windows with drawn graphics, play movies, massage text, manipulate file resources (careful!), and do dozens of other handy things you'd normally need an application to do.

So how do we find out what's in a scripting addition, or in a scriptable application? In Apple's Script Editor, choose Open Dictionary... from the File menu, then open the scripting addition or the scriptable application. Lo and behold, everything that scripting addition or application file can do in AppleScript is displayed! What you are looking at is the dictionary window, which shows the scripting addition's or application's terminology - the words and phrases that application provides as its extensions to the AppleScript language. Dictionaries can be hard to understand, though, and to make things worse, they may be the only documentation you have. They will become clearer as you learn AppleScript, fortunately, but perhaps only after considerable trial and error. (It's worth noting that Scripter has "builder" windows that allow you to point and click on words and phrases in the terminology to help assemble the commands.)Also in the last example, notice you had a moving target - the fax server hardly ever goes down just so you can test your script. Here's where a debugger and a simple trick can be a big help: You could put in a dummy command representing the two possible conditions, each in turn, then step through your script to see if it takes the path you expected. This is called "exercising your script" - actually executing every line at one time or another to be sure it works as expected.

For example, instead of:

  set z to the Network Address of
    (Pick Server using "Pony Express" without picker)

substitute

  set z to 0

then

  set z to 1

to "exercise" both possible paths in the debugger. It beats crashing the fax server just to test your script. If you can easily control the condition you're testing for, such as the existence of a file or folder, then change the condition and step through the script again for an even better test.

Other Solutions (for Motivational Purposes)

  • Enter a lawyer's special task with a due date in FileMaker. From within FileMaker, the lawyer(s) is sent email with details, and date of origin and due date events are created in Now Up-To-Date so management can see the big picture at a glance. Reminders are sent every three days until completed.
  • All users can query the case log database via a FaceSpan application. Features hot help, printing, and copying results to the Clipboard.
  • Premise also has a bad habit of forgetting where the shared Library folder is if you start it without the file server mounted (a common occurrence despite many warnings to users). A "Rescue Books" script makes a backup copy of the Library folder's alias created by Premise, and restores it again if lost. This is great if I'm not there to make the rather complicated fix. A similar script, "Rescue WP," backs up and restores WordPerfect's preferences, which often get corrupted, causing a crash on launch.
  • Forward QuickMail messages and attachments to an Internet account via Outlook Express. Inserts list of attachments and what program created them into the message body.
  • Install or upgrade QuickMail and 4-sight Fax, deleting old files and aliases, and creating new aliases. Faster and cleaner than using installers.
  • One step drag and drop sending of files from home to office and vice versa.
  • In progress: a network In/Out board.

Rolling Your Own - Tying Together Applications

The other aspect of extensibility, in addition to scripting extensions, is scriptable applications. FileMaker Pro, the leading database on the Mac, is perhaps the best example of this (well, QuarkExpress has the larger AppleScript dictionary, but FileMaker is of more interest to network administrators). There is enough in some applications' dictionaries to keep you occupied for a long time. Seriously, you may well have to prioritize your scripting efforts - either that, or hire an assistant to fix machines while you script (my secret master plan).

One gotcha: You may not find a word about AppleScript in the application's manual. Other than its AppleScript dictionary, FileMaker's only documentation is in a document optionally installed. No documentation is available for Microsoft Outlook Express beyond its dictionary (I asked) - you'll have to join the Outlook Express mailing list or visit The Unofficial Microsoft Outlook Express Page (see info at the end of this article) for more information and sample scripts.

Putting a Face On Your Script

Scripts that just copy or delete files don't require much of a user interface, if any. Beyond the very simple alert dialog shown above, AppleScript offers nothing in the way of user interface. If you want to display data and offer execution options via buttons and menus, there is one magic name to remember: FaceSpan.

If you have an existing script, you can literally throw together a FaceSpan project in a few minutes. Just make a window, add a button, attach your script to the button, and display the result (or results) in a "text box." A number of other window objects are available: scrolling list boxes, tables (similar to a spreadsheet), text labels, pushbuttons, radio buttons, scroll bars, various types of slider controls, tabbed windows, reveal ("twirly") arrows, lines, rectangles, picture boxes, and even QuickTime movie boxes. Any object can have a script attached that runs when the object is clicked. The appearance and behavior options for each object type are extensive.

FaceSpan will likely keep you up nights just playing with all its options. Unfortunately, it's a little beyond the scope of this article, but it's a "must have" - right after your debugger. I urge you to get the free demo and manual and take a look.

MISSING FIG 2!
Figure 2. Here's a FaceSpan application with a real Mac look: radio buttons, a default button, a scroll bar, clickable icons, hot help, and data entry fields. Its lets any user on the network access a FileMaker database with no training necessary.

Grad School: Taming a Problematic Application

Of all the software you have running on your network, one has to be the worst. For me, that one is Premise, West Group's CD-ROM-based application for legal research. Usually you just stick in the CD-ROM you need at your own workstation, but we copied all the CD-ROMs - 36 in all - to three 4-gig hard drives and hung them on a file server. Now any user on our network can use any CD-ROM, with one restriction: West's fiendish licensing scheme.

In a shared "Library" folder, Premise manages the number of users of each "book" (the CD-ROMs roughly parallel real law books). After two years, I finally discovered that sometimes the main license-tracking file, LICENSE.LIC in the Library folder, doubled in size periodically, sometimes several times a week. As it grows, Premise takes longer and longer to open and close books (or just crashes) - and we have a lot of glacial Duo 230s. I needed to be alerted when the file grew. This turned out to be a fairly simple, but extremely important "breakthrough" script. Saved as a stay-open applet, it checks LICENSE.LIC's size every 30 seconds. The script was similar to the one above that checks to see if the fax server is up, and was later dropped in to a new FaceSpan mini-app with only minor mods.

But while I was under the hood, I decided it would be a good idea to log the increase for use by sympathetic but stumped West Tech Support people and added that feature later. With the log, we hope to determine what circumstances cause the file size to double. Lastly, I needed to know how many users actually have a book open because I can't add book updates while they do. That is determined by the number of files that end in ".tmp" in the Library folder. Checking the license size and for the existence of .tmp files can easily be rolled into the same script, and displayed in the same FaceSpan window. The size-checking commands were reused so that the LICENSE.LIC file size and count of .tmp files are done each pass.

Log increasing file size

property licSize : 0
  -remembers last licSize between launches
global didBeep
on run
  -initialize
  set didBeep to true
  -not shown: other FaceSpan initialization commands
end run
on idle
  -called when nothing else is happening
  tell application "Finder"
    if the disk "Old Bailey" exists then
      set newSize to (the size of the file ¬
        "Old Bailey:Library:LICENSE:LICENSE.LIC")
      set numTemps to the count of (every item of alias ¬
         "Old Bailey:Library:LICENSE" ¬
        whose name ends with ".tmp")
    end if
  end tell
  if newSize != licSize then 
  -aha, the size has changed, alert the media
    beep

Using the concatenate operator, "&," we can build up a meaningful message for our alert dialog:

    display dialog "New size: " & (newSize as integer) ¬
     & return & "Old size: " & (licSize as integer) ¬
    & return & "Diff: " & ((newSize - licSize) ¬
    as integer) with icon note buttons "OK" default button 1
    set myFile to my OpenFileIfItExists ¬ 
      ("Data:License Info", true)
      -OpenFileIfItExists handler opens the output file (handler not shown)
    if myFile < 0 then
      - we got an error
      display dialog the result
    else
      -write date/time and new size to text file
      set myInfo to (((the current date) as text) & " " & ¬
      (newSize as integer) as text) & return
      write myInfo starting at eof to myFile
        -eof is "end of file"
      close access myFile
        -all done writing to log file
    end if
    set licSize to newSize
     -remember changed file size
  end if
  

Update the FaceSpan window's text items and use text to speech to alert you when there are no users with open books:

  set label "licSize" of window "Main" to licSize
  set label "numUsers" of window "Main" to numTemps
  if numTemps = 0 then -no users with open books
    if not didBeep then -only speak first time through
      say "Zero Premise users." using voice "Zarvox"
      set didBeep to true -remember I've "beeped"
    end if
  else
    set didBeep to false
  end if
  return 30
    -"sleep" for 30 seconds
end idle

MISSING FIG 3!
Figure 3. A small, simple window displays the number of Premise users (count of .tmp files) and size of the LICENSE file. A FaceSpan option would allow this window to float above other applications, making it always visible.

More problems: Some books have only a single-user license, and some users go to lunch with a book open, preventing others from using it, just as with a real book. Apple Network Administrator's Toolkit lets you see what application is frontmost, but what if Premise is not frontmost, and you have 70+ lawyers and legal assistants, some in a different building blocks away, and you need to find the offender? You guessed it, AppleScript! I wrote a FaceSpan mini-app that "knows" who uses Premise (no need to check other users).

Using the Akua Sweets scripting addition, I get a list of who's online, then check each Premise user to see if Premise is in the list of open processes running on that user's computer, and display the results in a simple FaceSpan window. Note: This requires that program linking be turned on and that user "Guest" allows program linking, but otherwise requires no additional software on the target machines. You could write a small stay-open applet and ask it to gather and return the information (tends to be slightly faster), but the goal here was to be as unintrusive as possible, by eliminating the need to have an extra application running.

MISSING FIG 4!
Figure 4. A list of the users who have the target application open. Also shows the open applications for any user. Not pretty, but then no one sees it but me. The beauty is in the script instead. The same mini-app has controls to find all open applications for any user, which Apple Network Administrator can't do.

Who runs Premise?
on hilited theObj -clicked button "Find users of:"
  -get name of app to search for from a popup menu:
  set appToFind to the contents of the selection of the popup "appToFind"
  set userList to the storage item "userList" -list stored in FaceSpan object
  set premiseUsers to ""
  set numUsers to 0
  set label "numUsers" to "0"
  set listbox "allUsers" to "***"

This mini-app depends heavily on the Akua Sweets scripting addition. First, we use the network server names command to get a list of users online (remember we turn on program linking on target machines, this makes them show up here). This happens quite fast. We only check users in this list, since looking for an offline machine name takes a while to time out, and we only check machines in the list of Premise users, not every machine on the network. Using both lists drastically cuts down the time required to finish the search.

  -use Akua Sweets OSAX to get a list of users online:
  set allUsers to item 2 of item 1 of (the network server names)
  -goes very fast, saves time later by not looking for users    not online
  set countUsers to the count of items in userList
  set label "countUsers" to countUsers
  -set up progress bar:
  set the minimum of gauge "progress" to 0
  set the maximum of gauge "progress" to countUsers
  set the leap of gauge "progress" to 1
  set the visible of gauge "progress" to true -show progress    bar during scan
  set n to 0
  idle -lets FaceSpan update window
  repeat with theUser in userList
    set n to n + 1
    set the scroll of gauge "progress" to n -advance progress bar
    -save time by only checking users who use Premise:
    if theUser is in allUsers then
    if command down then return -bail out if command key is down
      set label "Status" to "NET"
      set listbox "apps" to {"***"}
      set textbox "User" to theUser
      set x to {} -initialize list of apps in use
      idle -lets window "Main" changes update
      set found to true
      with timeout of 10 seconds

Use talk as user "" on server theUser to "talk" to each machine in turn. Without this command, a "connect to..." dialog would come up for each user - impractical for a large number of users. Note that user "" (empty string) is shorthand for Guest.

Note that the "raw" AppleEvent class, «class prcs», is needed in place of "process" to compile when the machine name is a variable:

  -another Akua Sweets command bypasses the "connect to" dialog:
  talk as user "" on server theUser -"" means logon as guest
        tell application "Finder" of machine theUser
          try
            set x to the name of every process
            -returns list of apps
            -on mixed 7.6.1 and 8.x systems, use instead:
            -set x to the name of every «class prcs»
          on error
          end try -just ignore any errors
        end tell
      end timeout
      -if list of apps is empty, didn't find, or was error
      set found to x != {}
      if not found then
        set label "Status" to "OFF"
        idle
      else -found user
        set label "Status" to "LOC"
        idle -draw label "status"
        tell application "Finder" of machine theUser        try
  -again, «class prcs» is needed for mixed system versions:
        set y to ( the name of the first «class prcs» 
            whose frontmost is true)
          on error errMsg number errNum
            tell me to idle
            set y to "Finder"
          end try -just ignore any errors
        end tell
        if appToFind is in x then -build list of users
          set premiseUsers to premiseUsers & theUser & return
          set listbox "allUsers" to premiseUsers
          set numUsers to numUsers + 1
          set label "numUsers" to numUsers
          idle -draw listbox "allUsers"
        end if
        -Label frontmost app with * character
        repeat with i from 1 to count of x
          if item i of x = y then
            set item i of x to item i of x & "  *"
            exit repeat
          end if
        end repeat
        set listbox "Apps" to x
        idle
      end if -found
    end if -user online
  end repeat
  set the visible of gauge "progress" to false
    -hide progress bar
end hilited

With the list of possible offenders displayed, a phone call or two gets the books closed. A few more lines of script and you could get other information, such as free RAM and disk space.

Now my monster is more under control. I can track the file that causes crashes and slowdowns, tell when it's safe to update the library, and find errant users. You can use the same ideas to keep up to date on what's happening on your network.

[optional] What's next? Prescience. A giant script, or, more likely, a set of interactive scripts, that hunts down and fixes problems without human intervention and sends me a report once a month. Toss a few files in a folder on a server somewhere and all machines get updated to the latest stuff and an explanatory email gets sent to affected users. Status windows on a Mac with a bank of three or four monitors show what's up at a glance. Why not? Technically, you could come close to that today.

A Few Random Thoughts

A script doesn't have to be elegant, long, or complex. It just has to do the job. Start simple, and save every command - you'll find you can reuse a lot. If your scripts are to be used by others, build in more robust error checking and experiment with FaceSpan. If the script is just for you, I say just go for it. You can understand AppleScript's error messages, users can't.

Steal as much as possible from others, but understand how it works. Hail the day your new script compiles and runs the first time without error. You have arrived. By the way, don't forget to comment your scripts (unlike me).

Network administrators will find many, many uses for AppleScript once the scripting begins. If you have put off looking at AppleScript, I hope I have given you a few reasons to take that first step.

More Information

General info Books
Beginner:
  • AppleScript Handbook by Danny Goodman, ISBN 0966551419, http://www.dannyg.com/
  • AppleScript for Dummies by Tom Trinko, IDG Books, ISBN 1568849753
  • The Tao of AppleScript by Derrick Schneider, Hayden Books
Advanced:
  • Applescript Applications: Building Applications With Facespan and Applescript by John Schettino, Liz O'Hara, ISBN 0126239576
  • AppleScript for the Internet: Visual QuickStart Guide by Ethan Wilde, ISBN 0201353598
Mailing Lists Essential add-ons OSAX sources More info, links, goodies:

Russ Coffman has been a Mac user since 1984, a Mac consultant since 1985. Today he is the network administrator in the Dallas City Attorney’s Office, an all-Mac law office with 115 users. He has used AppleScript to develop numerous utilities as well as “wire together” various scriptable applications.

 
AAPL
$100.96
Apple Inc.
-0.83
MSFT
$47.52
Microsoft Corpora
+0.84
GOOG
$596.08
Google Inc.
+6.81

MacTech Search:
Community Search:

Software Updates via MacUpdate

Audio Hijack Pro 2.11.3 - Record and enh...
Audio Hijack Pro drastically changes the way you use audio on your computer, giving you the freedom to listen to audio when you want and how you want. Record and enhance any audio with Audio Hijack... Read more
Airfoil 4.8.9 - Send audio from any app...
Airfoil allows you to send any audio to AirPort Express units, Apple TVs, and even other Macs and PCs, all in sync! It's your audio - everywhere. With Airfoil you can take audio from any... Read more
WhatRoute 1.13.0 - Geographically trace...
WhatRoute is designed to find the names of all the routers an IP packet passes through on its way from your Mac to a destination host. It also measures the round-trip time from your Mac to the... Read more
Chromium 37.0.2062.122 - Fast and stable...
Chromium is an open-source browser project that aims to build a safer, faster, and more stable way for all Internet users to experience the web. FreeSMUG-Free OpenSource Mac User Group build is... Read more
Attachment Tamer 3.1.14b9 - Take control...
Attachment Tamer gives you control over attachment handling in Apple Mail. It fixes the most annoying Apple Mail flaws, ensures compatibility with other email software, and allows you to set up how... Read more
Duplicate Annihilator 5.0 - Find and del...
Duplicate Annihilator takes on the time-consuming task of comparing the images in your iPhoto library using effective algorithms to make sure that no duplicate escapes. Duplicate Annihilator detects... Read more
jAlbum Pro 12.2 - Organize your digital...
jAlbum Pro has all the features you love in jAlbum, but comes with a commercial license. With jAlbum, you can create gorgeous custom photo galleries for the Web without writing a line of code!... Read more
jAlbum 12.2 - Create custom photo galler...
With jAlbum, you can create gorgeous custom photo galleries for the Web without writing a line of code! Beginner-friendly, with pro results Simply drag and drop photos into groups, choose a design... Read more
Quicken 2015 2.0.4 - Complete personal f...
Quicken 2015 helps you manage all your personal finances in one place, so you can see where you're spending and where you can save. Quicken automatically categorizes your financial transactions,... Read more
iMazing 1.0 - Complete iOS device manage...
iMazing (formerly DiskAid) is the ultimate iOS device manager with capabilities far beyond what iTunes offers. With iMazing and your iOS device (iPhone, iPad, or iPod), you can: Copy music to and... Read more

Latest Forum Discussions

See All

View Source – HTML, JavaScript and CSS...
View Source – HTML, JavaScript and CSS 1.0 Device: iOS Universal Category: Utilities Price: $.99, Version: 1.0 (iTunes) Description: View Source is an app plus an iOS 8 Safari extension that makes it easy to do one key web developer... | Read more »
Avenged Sevenfold’s Hail To The King: De...
Avenged Sevenfold’s Hail To The King: Deathbat is Coming to iOS on October 16th Posted by Jessica Fisher on September 19th, 2014 [ permalink ] Just in time for Halloween, on October 16 Avenged Sevenfold will be launching | Read more »
Talisman Has Gone Universal – Can Now be...
Talisman Has Gone Universal – Can Now be Played on the iPhone Posted by Jessica Fisher on September 19th, 2014 [ permalink ] | Read more »
Tap Army Review
Tap Army Review By Jennifer Allen on September 19th, 2014 Our Rating: :: SHOOT EM ALLUniversal App - Designed for iPhone and iPad Mindless but fun, Tap Army is a lane-based shooter that should help you relieve some stress.   | Read more »
Monsters! Volcanoes! Loot! Epic Island f...
Monsters! Volcanoes! Loot! | Read more »
Plunder Pirates: Tips, Tricks, Strategie...
Ahoy There, Seadogs: Interested in knowing our thoughts on all this plundering and pirating? Check out our Plunder Pirates Review! Have you just downloaded the rather enjoyable pirate-em-up Plunder Pirates and are in need of some assistance? Never... | Read more »
Goat Simulator Review
Goat Simulator Review By Lee Hamlet on September 19th, 2014 Our Rating: :: THE GRUFFEST OF BILLY GOATSUniversal App - Designed for iPhone and iPad Unleash chaos as a grumpy goat in this humorous but short-lived casual game.   | Read more »
A New and Improved Wunderlist is Here fo...
A New and Improved Wunderlist is Here for iOS 8 Posted by Jessica Fisher on September 19th, 2014 [ permalink ] Universal App - Designed for iPhone and iPad | Read more »
Evernote Update for iOS 8 Adds Web Clipp...
Evernote Update for iOS 8 Adds Web Clipping, Quick Notes, and More Posted by Ellis Spice on September 19th, 2014 [ permalink ] | Read more »
Apple Names Ultimate Productivity Bundl...
Apple Names Ultimate Productivity Bundle by Readdle as the Essential Bundle on the App Store Posted by Jessica Fisher on September 19th, 2014 [ permalink | Read more »

Price Scanner via MacPrices.net

iFixIt Tears Down iPhone 6; Awards Respectabl...
iFixit notes that even the smaller 4.7″ iPhone 6 is a giant among iPhones; so big that Apple couldn’t fit it into the familiar iPhone form factor. In a welcome reversal of a recent trend to more or... Read more
Phone 6 Guide – Tips Book For Both iPhone 6...
iOS Guides has announced its latest eBook: iPhone 6 Guide. Brought to you by the expert team at iOS Guides, and written by best-selling technology author Tom Rudderham, iPhone 6 Guide is packed with... Read more
How to Upgrade iPhone iPad to iOS 8 without D...
PhoneClean, a iPhone cleaner utility offered by iMobie Inc., reveals a solution for upgrading iPhone and iPad to iOS 8 without deleting photos, apps, the new U2 album or anything. Thanks to more than... Read more
Inpaint 6 – Photo Retouching Tool Gets Faster...
TeoreX has announced Inpaint 6, a simple retouching tool for end users that helps remove scratches, watermarks, and timestamps as well as more complex objects like strangers, unwanted elements and... Read more
Worldwide PC Monitor Market Sees Growth in To...
Worldwide PC monitor shipments totaled 32.5 million units in the second quarter of 2014 (2Q14), a year-over-year decline of -2.9%, according to the International Data Corporation (IDC) Worldwide... Read more
Updated Price Trackers
We’ve updated our Mac Price Trackers with the latest information on prices, bundles, and availability on systems from Apple’s authorized internet/catalog resellers: - 15″ MacBook Pros - 13″ MacBook... Read more
Mac Pros available for up to $260 off MSRP
Adorama has Mac Pros on sale for up to $260 off MSRP. Shipping is free, and Adorama charges sales tax in NY & NJ only: - 4-core Mac Pro: $2839.99, $160 off MSRP - 6-core Mac Pro: $3739.99, $260... Read more
13-inch 2.6GHz/256GB Retina MacBook Pros avai...
B&H Photo has the 13″ 2.6GHz/256GB Retina MacBook Pro on sale for $1379 including free shipping plus NY sales tax only. Their price is $120 off MSRP. Read more
Previous-generation 15-inch 2.0GHz Retina Mac...
B&H Photo has leftover previous-generation 15″ 2.0GHz Retina MacBook Pros now available for $1599 including free shipping plus NY sales tax only. Their price is $400 off original MSRP. B&H... Read more
21″ 2.7GHz iMac available for $1179, save $12...
Adorama has 21″ 2.7GHz Hawell iMacs on sale for $1179.99 including free shipping. Their price is $120 off MSRP. NY and NJ sales tax only. Read more

Jobs Board

*Apple* Retail - Multiple Positions (US) - A...
Sales Specialist - Retail Customer Service and Sales Transform Apple Store visitors into loyal Apple customers. When customers enter the store, you're also the Read more
Position Opening at *Apple* - Apple (United...
**Job Summary** At the Apple Store, you connect business professionals and entrepreneurs with the tools they need in order to put Apple solutions to work in their Read more
Position Opening at *Apple* - Apple (United...
**Job Summary** The Apple Store is a retail environment like no other - uniquely focused on delivering amazing customer experiences. As an Expert, you introduce people Read more
Position Opening at *Apple* - Apple (United...
**Job Summary** As businesses discover the power of Apple computers and mobile devices, it's your job - as a Solutions Engineer - to show them how to introduce these Read more
Position Opening at *Apple* - Apple (United...
…Summary** As a Specialist, you help create the energy and excitement around Apple products, providing the right solutions and getting products into customers' hands. You Read more
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.