Question of AppleScript capabilities

Hello,

I would be extremely grateful for some advice regarding a problem I’m trying to solve, and whether AppleScript has the flexibility to help me tackle it.

The problem:
I am attempting to come up with a method of taking automated and unattended backups on workstations where the users are running MS Entourage. This is a bit of a vexing problem for a number of reasons. First, Entourage saves all of its data – email, contacts, calendar data, etc – in a single monolithic database. Second, Entourage and all other MS Office applications use a central database engine (the Microsoft Database Daemon) to access the database. In order to backup the database in a quiescent state, all the Office applications must be shutdown, and then the DB engine itself must be shutdown. Only then can the database be copied with any confidence that buffers are flushed, and the database is uncorrupted.

My approach:
Given this somewhat suboptimal context, I would like to script a solution whereby a dialog box flashes on the screen with a timed countdown progress bar (“Proceed with Entourage backup?”) allowing the user to accept or delay the backup. This dialog box would inform the user that all MS Office applications would need to be closed, and open documents need to be saved. If the user accepts (or time runs out), the dialog box would close and each MS Office application would be shutdown, ending with a shutdown of the DB engine. After the backup is taken, all applications that were originally active would be restarted.

My questions:

  1. Is AppleScript capable of displaying a timed dialog box (with some indication of elapsing time) which will automatically close after the time has elapsed?

  2. If a document is open in MS Word, or a compose window is open in Entourage, the Office application will throw up an additional “Are you sure?” dialog box when it is told to quit. I am willing to force a shutdown of the application if the user is not present at the workstation, however how can I prevent these additional application dialogs from causing the script to hang?

Ultimately my question is whether AppleScript is the correct tool for this job, or whether I should resort to a different tool?

Thank you very much for your time, and for any insight you might have.

AN.

In my opinion…its sounds like something that would be best suited for applescript studio that way you could give a countdown option and also show a progress pannel of what it is currently working on until its done. I think you would have to make it a startup item so it would run all the time I’m assuming it would run once a day… thinking about that wouldn’t it be better to just have a program that runs at midnight on a server that goes to all machines running on the network and backs up the data… you would have to have it make sure all that stuff wasn’t running all the same but you may be able to assume that you can close the programs if you know people are not really there

some stuff to ponder
mm

Thank you for your reply!

Thank you very much for the tip – I will look into AppleScript Studio. Up until now I’ve mostly dabbled with the script editor. Based on what you’re saying, however, it sounds as though the answer to my first question is “yes”, and that AppleScript can handle the timed dialog box?

In fact, my intent is to run the Entourage backup procedure I’m asking about in conjunction with script hooks from Retrospect, or using a cron job for automation. Either way, unfortunately, I don’t think I can ever really assume that users won’t be present.

AN.

Plain AppleScript doesn’t have a progress indicator, but you can do something like this:

display dialog "Proceed with Entourage backup?" buttons {"Cancel", "Proceed"} giving up after 2 default button 2

Hello Bruce,

Excellent – thank you! One minor question, what distinction are you drawing by saying “plain AppleScript”? Are there other flavors of AppleScript which might have a progress indicator?

Finally, do you perhaps also have any insight into my second question regarding the issue of having open dialogs hang the tell/quit command?

One thing I’ve noticed is that when I send a tell/quit to an Office application with an open dialog or compose box, the tell will hang until the user responds to the dialog. If I then send a second tell/quit to the same application, it seems to quit unconditionally. This leads me to wonder if one can tell an application to “force-quit”? Or, alternatively, can one add a “giving up after” clause to a tell?

Thanks again for your time!

AN.

Google up 24U Appearance OSAX, a scripting addition that lets you compose all sorts of prograss bars in OSX.

Eelco Houwink