Part of the scripting.com web server. San Francisco CA USA. 9/14/96.

Creating a new script in Frontier 4.1

With the advent of MacBird cards in Frontier 4.1, making new scripts can now be easier and more powerful.

By Dave Winer, dwiner@well.com

This is a cool little project I did yesterday to experiment with MacBird cards running inside Frontier. It turned into an extensible framework, and at the same time simplified something Frontier users do all the time -- create new scripts.

It's in the Lab Website, because I want to let this incubate a little among the experts before releasing it for general use.

I modified the New Desktop Script command in the UserLand menu. Now its name is New Script. Same keystroke, cmd-N.

Requirements, installation

This package requires Frontier 4.1, which I assume you already have. The package, called the "New Script Command" can be downloaded at:

ftp://ftp.scripting.com/userland/newScriptCommand.sit.hqx

It includes a new version of the Scheduler suite, that has been modernized to store the tasks table in a sub-table of the user table.

A higher level framework for hourly and overnight tasks is also implemented.

It's very important that you run the runMeFirst script first. It saves your scheduler tasks table and log outline from being overwritten by the new version of suites.scheduler. You can run the other scripts in any order you like. Click on OK for each of the confirmation dialogs.

After installing, edit Frontier's menu, press cmd-M. In the UserLand menu, delete the New Desktop Script command, and move the newly installed New Script command to the place it used to occupy.


Here's what the New Script dialog looks like...

Given the settings as shown above, when you click on the OK button, a new UserTalk script will be created in the system.agents table.

Here's the Kind popup menu:

And here's the Language popup menu:


How to use it

When you want to create a new script press cmd-N. Choose a Kind, choose a language, click on OK. Edit the script. Debug. Run. Ship.

It's open architecture

The architecture is in user.preferences.newscript. Look in the kinds subtable. Each table contained in this table represents one of the kinds in the popup menu. Each table contains two bits, the address of the table that contains this kind of script, and a script that initializes the script. All of the scripts are supplied, but some of them are not complete.

Each script take two parameters, the address of the new script, from which you can determine its name using the nameOf verb, and the language that the user selected from the popup menu.

By far the most extensive script is in the CGI script table. It's the perfect home for the script that Mason Hale wrote (thanks Mason!). I have the UserTalk implementation, and I'm wondering what the AppleScript version would look like. There's a case statement in the script, check it out, it's interesting.

A really elegant script -- user.preferences.newscript.kinds.["Desktop script"]. It has both an AppleScript and a UserTalk branch.

It's open so we can have fun. Let's.

Enhancements to suites.scheduler

The data for suites.scheduler is now stored in user.scheduler. scheduler.tasks has moved to user.scheduler.tasks, and scheduler.log to user.scheduler.log. I think I caught all the dependencies, please let me know if I didn't.

Scheduling hourly and overnight tasks is easier using the New Script dialog. Any script in user.scheduler.hourly runs once per hour on the hour. Any script in user.scheduler.overnight runs every night at 2AM. Two new entries in user.scheduler.tasks support these features.

Discussion

Please discuss on the Frontier-talk list.

Pointer

The Scheduler Suite page provides background on the Scheduler suite, of course.


This page was last built with Frontier on a Macintosh on Sat, Sep 14, 1996 at 11:14:02 PM. Thanks for checking it out! Dave