[comp.windows.news] Doing initial setup in NeWS

sai@sun.uucp (Steve Isaac) (03/25/88)

In addition to (and complementing) the user.ps/.newsrc approaches that have
been described to do initial setup in NeWS, you can use the new journalling 
facility in NeWS1.1 to do some of your setup. This approach lets you literally 
do anything you can do with a keyboard and mouse automatically during setup.

To do this, record a journal script that does what you want to do, then 
have it play back by putting the following at the end of your user.ps:

% Kick off startup script
{ newprocessgroup 
  1 120 div sleep  % Wait for the server to start up (only needed if user.ps
		   % is called before the server is started up)

  % Tell the user when journal playback is complete
  {
     % Create an event that matches the journalling end-of-play event
     createevent dup begin
        /Name /JournalEvent def
        /Action /EndPlay def
     end expressinterest
     % Wait for this event to be generated
     awaitevent
     pop
     currentcursorlocation (Journalling Initialization Complete) popmsg
  } fork pop

  % Tell the user that we are starting journal playback (optional)
  currentcursorlocation (Starting Journalling-Driven Initialization) popmsg
  1 60 div sleep

  % Give the name of our journal playback file to journalling (~/.newsjournal)
  Journal /PlaybackFile (~/.newsjournal) put

  % Start journal playback
  journalplay
} fork pop

One little trick for recording; journalling adds a main menu item when it
is brought up. This will cause a problem when you are recording, since
this menu item will not be there during playback. Here is a little program
that will bring up the journalling control panel without having an
extra menu item installed:

#! /usr/NeWS/bin/psh
%
%  Bring up the journalling control panel w/o a menu entry
%
   systemdict /Journal known not {(NeWS/journal.ps) run} if
   JournalUI {def} forall       % Include all of JournalUI in our userdict
   startlistener                % Start the journalling process
   createcontrolpanel           % Create our window
   {displaycontrolpanel} journaldoit % Bring up the control panel

By the way, NeWS1.1 is a shipping product. It is now simply a question of 
how fast your NeWS1.1 order gets processed...

			Steve Isaac
			Sun Microsystems
			sun!sai