RunRR

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

Introduction

This AppleScript can be used in conjuntion with RevRdist or similar hard disk maintenance software (i.e. Assimilator). Basically, it checks that the RevRdist application & preferences exists, then tries to mount the file server volume(s), starts RevRdist and quits.

On each of the above actions, it provides error checking, and creates a log file.


What this script does

The first thing this script does is put up a message (using Appearance OSAX) telling users that the machine is running maintenance. This is because it takes awhile to mount the servers and startup RevRdist. It also can swap the desktop image with a maintenance image.

Second, this script mounts the server(s) volume(s) over IP or AppleTalk (tries IP first then AppleTalk if IP doesn't work).

Third, this script starts RevRdist.

A log of activity/errors is updated/created.

Suggested/required files/scripting additions

This script requires the freeware application RevRdist. Specifically, the script requires the application file named "RevRdist" and the prefs file named "RevRdist Prefs".

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

Modifications to the script

This script has been setup to make it as easy as possible for you to use it in your own environment/setup. For this script to run properly, you will need to modify it for your computer setup. This modifications include adding filenames, paths, and variable information.

A filename is just the filename that appears on a file. In Finder, you can select a file and copy the filename text by selecting copy from the Edit menu.

A path is the folder structure for a file or folder. A path begins with the hard disk name and is followed by a colon (":"), then each folder separated by a colon (":"), until last item which can be a file or folder. An example of a path is "Hard Disk:System Folder:Finder". This is the path to the Finder application located in the System Folder with a hard disk name "Hard Disk". Because the startup disk name is easily changed on Macintosh, this script finds the startup disk name on the Macintosh the script is running. Therefore, do not include the startup disk name in any paths for this script.

A variable is a bucket used by the Macintosh to store information. In scripts, variables are given names that the user can tell which bucket belongs to what information. In AppleScript, a bucket is "filled" with information with this syntax:
set variableName to "information"
To modify this script to work with your environment, just find the "set" command for each variable and change or enter the appropriate information with the quotes ("")

Required modifications to the script

This script is designed to check for the RevRdist application and preferences in two different locations, a "default" and "alternate" location. This isn't absolutely necessary, but suggested to prevent users from trying to disable RevRdist by deleting or moving of the application and/or preferences file or give alternatives for running RevRdist due to corrupted files. The following lines specify variables that will contain paths for these "default" and "alternate" location(s):
set pathToDefaultRevRdistFile to ""

This line contains a variable "pathToDefaultRevRdistFile" which will contain the path to the default RevRdist application. (example ":System Folder:RevRdist")

set pathToDefaultRevRdistPrefsFile to ""

This line contains a variable "pathToDefaultRevRdistPrefsFile" which will contain the path to the default RevRdist preference file. (i.e. ":System Folder:RevRdist Prefs")

set pathToAlternateRevRdistFile to ""

This line contains a variable "pathToAlternateRevRdistFile" which will contain the path to the alternate RevRdist application. (i.e. ":System Folder:Alternate:RevRdist")

set pathToAlternateRevRdistPrefsFile to ""

This line contains a variable "pathToAlternateRevRdistPrefsFile" which will contain the path to the alternate RevRdist preference file. (i.e. ":System Folder:Alternate:RevRdist Prefs")
The following script lines specify variables for the server address, username, and password. Since this script can mount more than one server volume, the settings are stored in a list variable. The main point you need to know about list variables is that the values are contained in brackets "{..}" and are separated by commas "{value1, value2, etc}" and lists can have any number of values.

For this script, there must be a information for each server, even if it is blank. For example, if you wanted to mount one server using AppleTalk and one using IP, you must have values for the other variables set to "".

These are the script's file server variables lines:
set numberOfServersToMount to 1

This line contains a variable "numberOfServersToMount" which indicates number of servers to mount. Be sure that the number of items in each network variable match this number (each item is a set of quotes followed by a comma: {"", "", ""} = 3, or {""} = 1, etc.).

set DNSServerName to {""}

This line contains a variable "DNSServerName" which will contain the DNS name of the server. Set to "" if using DNS is not desired. (i.e. "macpd.cc.utah.edu")

set ipOfVolume to {""}

This line contains a variable "ipOfServer" which will contain the IP address of the server. Set to "" if using IP is not desired. (i.e. "128.110.56.121")

set appleTalkServer to {""}

-- the AppleTalk name of the server. Set to "" if AppleTalk connecting is not desired. (example: "Mac PD Server")

set appleTalkZone to {""}

-- the AppleTalk Zone the server is in. Set to "" if AppleTalk connecting is not desired. Required for AT connecting. (example: "UUCC Student Labs")

set imageVolumeName to {""}

-- Required for any connecting. (example: "Public Software")

set userName to {""}

-- Username, required for any connecting. (example: "Guest")

set passwd to {""}

-- Password, required for any connecting.

Optional modifications to the script

set pathTomaintenancePic to ""

-- path to the maintenance background picture file. Set to "" if not desired. (example: ":System Folder:Appearance:Desktop Pictures:Maintenance.jpg") If you use this, your RevRdist image must have a specified background image or the maintenance picture will be there after RevRdist is done)

set pathsToIdleScripts to ""

-- path to the idle scripts. Set to "" if not desired. (example: ":System Folder:Scripts:Idle Script"") This prevents idle scripts from launching when RevRdist is running (with iDo Script Scheduler). You can put as many paths between the quotes as you want.

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:Maintenance: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.

Running the Script

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

There will be future work on writing a script that resides in the startup items folder and checks the time or when RevRdist ran last to determine whether or not to activate this script.

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 file, or just email me.

What is new?

12.22.2000 disabled a line that turned file sharing off because sometimes it would crash the computer.

2.5.2001 added new version of SaveToLog (see bottom of script).

4.?.01 Added maintenance pic background.

6.3.2001 moved the maintenance pic code around. General clean up.

6.4.2001 added new version of SaveToLog (see bottom of script).

6.5.2001 removed code to turn file sharing off. Why was it there to begin with?

6.6.2001 added code to quit Crond if the servers don't mount. If you don't use Crond, it won't matter. If you do, this is to make sure that Crond doesn't endlessly call this script (assuming that is what is going on).

7.3.2001 added code to duplicate original desktop picture prefs so that if revrdist doesn't copy new prefs, the original picture will return anyway. (This worked in development, but not in deployment. soo...)

Download the script

Download the script: RunRR 1.0.5 – HQX-File, 184.0 KB