RevRdist Status

By: James Reynolds - Revised: 2006-06-08 devin

Introduction

The purpose of this script is to help lab administrators quickly and easily see exactly when RevRdist ran last.

This is important because sometimes RevRdist will quit running the way it should. Many times, RevRdist will not run because the ethernet cable is unplugged or the AppleTalk or TCP/IP settings have been changed. Another example would be if you were automatically launching RevRdist with Energy Saver and the settings were changed. Another example would be if a user removed the RevRdist application or preferences from the Mac.

Without some sort of scripted feedback to the administrators, there is no way of knowing when this happens. It is left to the user to finally get tired of the computer not working to report the problem. In a large lab setting, the users just move to a working computer and so a problem can go unreported for a long time.


Related Scripts

Here is a list of other scripts that are related or used with this script:
SaveToLog, a script that this script incorporates and uses to maintain a log file.

RunRR - a script that runs RevRdist.

What the script produces

On the desktop a file will be created and located at the bottom right of the screen (under the trash). It is named something like "RR Ran Fri 12/15 at 6:10 PM".

A feedback message is shown on the screen letting the user know the script is running.

A log of errors and activity is also created and updated.

Required scripting addition

This script requires a freeware scripting addition: Jon's Commands (gets the screen resolution to place the RevRdist status file on the desktop; the script will still run without this, but it would be pointless since the icon would be located on the right hand side with the other volumes, folders, and files) URL: http://www.seanet.com/~jonpugh/.

Suggested scripting addition

This shareware scripting addition is recommended: Appearance OSAX (needed for user feedback) URL: http://www.appleklub.cz/~koudelka/ (link dead).

The template file

For this script to run, there has to be a file that is used as the template. Preferably this file has a blank icon and does something useful when clicked on.

To create a file that does nothing (every file always tries to open or activate when clicked unless made not to), create a blank AppleScript and save it as an "Application" or "Classic Applet" with "Never Show Startup Screen". Another option is to make an AppleScript that does some sort of task like run other maintainance or open the RevRdist log.

To create a blank icon, you can use a paint program to copy a white graphic, or use ResEdit. Or find a file with a blank icon, get its info, select the icon, copy it, get the info of the second item, select the icon and paste.

Or the template that comes with the script.

Required modifications to the script - path and file name variables

For this script to run properly, you will need to modify it for your computer setup.

A filename is just the filename that appears on a file. If you click on a file, you can copy the filename text by selecting copy from the Edit menu.

A path is the folder structure that leads to a file or folder. A path begins with the hard disk name and is followed by a colon (":"). Every folder is seperated by a colon (":"). The last item is the file. The path to the Finder application is "<startup disk name>:System Folder:Finder". Because the startup disk name is always different on every machine and because they are often changed, this script finds the startup disk name. Therefore, do not include the startup disk name in any paths for this script.

A variable is a bucket used by the computer to store information. In scripts, variables are given names so that the programmer can tell the computer which bucket is what. In AppleScript, a bucket is "filled" with information with this syntax:
set variableName to "information"
Therefore, to set the variables for this script, just find the "set" command for the approprate variable and change the value within the quotes to the information needed for the following:
set nameOfDefaultStatusFile to ""

The nameOfDefaultStatusFile variable should be set to whatever the NAME of the file is on the machine, something like: "RevRdistStatusTemplate".

set pathToDefaultStatusFile to ""

The pathToDefaultStatusFile variable should be set to whatever the PATH of the file is on the machine, something like: ":System Folder:Maintainance:".

Paths usually end with the filename. For this script and variable, do not include the filename.

set pathToLog to ""

The pathToLog variable should be set to the path to a text file that serves as a log for this script, something something like: ":System Folder:Maintainance:Log". Set the variable to "" if no log is desired. The script will create the file if it doesn't exist and set it to be a BBEdit document.
In the script, these variables appear after this comment (very near the top of the script):

-- SET THESE VARIABLES ***********************************

Optional modifications to the script

To change the name of the message of the file that appears on the desktop, find the following comment:

-- ////////////////////////////////////////////////////////////
-- Set name of the Status file here! - Must be 31 or less characters.

The code following this comment calculates the filename. You will need to know what you are doing to successfully change the name.

How to run

The easiest way to run this is script is to save it as an "Application" or "Classic Applet" with no startup window and then put it in the startup items folder or have it activated with something like Cron.

You could also copy the contents of this file, paste it into a different script and set the variables and then put the handle call where ever you want in your new script.

You could also eliminate the variable settings and handle call below and "include" this in a different script as a library.

How this script works

This script is essentially a "black box". That is, you only need to know what to put in and what comes out (which is discussed above).

However, if you have a dying urge to know more, comments have been included in the handles, and here is a brief discription:
This script begins by adding the startup disk name to the paths and then getting the screen size.

It then shows a message box telling the user what is going on.

Then it checks to see if the file "RevRdist log" exists in
"System Folder:Preferences:" and if the template status file exists. If they exist, the script calculates when RevRdist last ran, duplicates the template status file and then moves the file to the desktop.

The script places the status file to the bottom right corner of the desktop (if Jon's Commands is installed).

If the template status file don't exist, it logs the missing file. If the "RevRdist log" is missing, it logs the missing file and places an error message on the desktop saying the "RevRdist log" is missing.
View a flowchart of the script:

Flowchart page 1 – GIF-File, 5.3 KB
Flowchart page 2 – GIF-File, 8.5 KB
Flowchart page 3 – GIF-File, 6.7 KB

Download the script