                        Example Scripit Scripts
                        -----------------------

                          By: Khalid Aldoseri


-----------------------------------------------------------------------------
                                Example 1
-----------------------------------------------------------------------------

This is a script that shows you how to launch any program
and do a set of actions:

begin
select wait 1000 abort
runback "full pathname" arg1 arg2 ... argn
select "program's screen name" "program's window name"
menu    MenuName MenuItem [SubItem]
menu    .... etc.


Example:

begin
select  wait 1000 abort
runback "dh2:Access/Access!"
select  screen "Access"
menu    "Phone" "Re-Dial"

Notes:

    The quotes are not important unless you have spaces or commas
    in the arguments.

    If you need to specify any CLI command switches when running
    the program use:  runback programname arg1 arg2 .. argn

    With Access, it's best if you wait for all its windows to
    appear on the screen, so you can either add a WAIT statement
    after the SELECT, or you can change the SELECT to become
    a  (SELECT Access ^4)  This tell Scripit to wait until four
    windows show up on the Access screen.

-----------------------------------------------------------------------------
                                Example 2
-----------------------------------------------------------------------------

This is an expanded example of Example 1:

begin
select wait 1000 abort
runback "dh2:Access/Access!_Supra"
select Access ^5
menu Phone Re-Dial
runback "dh2:Access/ShowModem -sAccess"
select Access "Supra Modem"
window moveto 640 0

The following is a full description of it:
(all lines starting with ;; are comments and are ignored by Scripit.)

;; This Scripit script will load Access, tell it to start dialling
;; then run the Supra ShowModem program and move its window to
;; the top left corner of the screen.
;;
;; By: Khalid Aldoseri.
;;
;; Begin script
begin
;; Set 'select' wait time to 1000 jiffies (20 seconds) with abort mode on.
;; Note: I set the abort mode on because the script would be useless if
;; the Access window didn't show up at all.
select wait 1000 abort
;; Run Access
;; Replace this with the full path of where your copy of Access is.
runback "dh2:Access/Access!_Supra"
;; Wait until all of Access's five windows show up.
;; Note:  If you're not using the chat window change the
;; ^5 to ^4.
select Access ^5
;; Tell Access to Re-Dial.  i.e. dial first number in list.
menu Phone Re-Dial
;; Run the Supra ShowModem program.
;; Replace this with the full path of where your ShowModem is.
runback "dh2:Access/ShowModem -sAccess"
;; Wait until ShowModem's window shows up.
waitfor Access "Supra Modem"
;; Move it to the top right corner of the screen.
window moveto 640 0
;; Note:  Remove the lines with ;; if you don't want them.

-----------------------------------------------------------------------------
                                Example 3
-----------------------------------------------------------------------------

This is a small script that expands the current CLI window, moves the cursor
to the top, and then clears the whole window including its borders. This
gives you a blank CLI with no borders.

begin
select active
window moveto 0,0
wait 10
window maxsize
wait 10
con move 0,0
gfx clear 0,0


Here it is again with comments:

begin
;; Select the active CLI.. normally the one it was started from
select active
;; Move that window to the top left corner of the screen
window moveto 0,0
;; Wait a while to make sure the window move operation is done
wait 10
;; Resize the window to the maximum size possible
window maxsize
;; Wait a while to make sure the window resize operation is done
wait 10
;; Move the console cursor to the top
con move 0,0
;; Clear the window's text/graphics starting from 0,0
gfx clear 0,0

-----------------------------------------------------------------------------
                                Example 4
-----------------------------------------------------------------------------

Here's one the runs WordPerfect, resizes its window to fit half the screen,
tells WP to open a new window, resizes that to half as well and moves it to
the bottom of the screen, giving you WP ready for action with 2 windows
ready. (grin)

begin
select wait 1000 abort
runback "WP:WP"
select Workbench WordPerfect
window resizeto 640,100
wait
menu Project New
select Workbench "WordPerfect 4.1 - Doc 2"
window resizeto 640,100
wait
window moveto 0,100


Commented Version:

begin
select wait 1000 abort
;; Run WordPerfect
runback "WP:WP"
;; Wait for WP to show up on the Workbench screen
select Workbench WordPerfect
;; Resize WP's window to 640 by 100
window resizeto 640,100
;; Wait until resize operation is done.
;; You might have to increase the wait time if this isn't
;; enough.  (default wait is 25.. i.e. 1/2 second).
wait
;; Select the menu 'Project' 'New' to open a new window.
menu Project New
;; Wait until the second window shows up.
select Workbench "WordPerfect 4.1 - Doc 2"
;; Resize second window to 640,100
window resizeto 640,100
;; Wait again.
wait
;; Move the second window to 0,100.
window moveto 0,100

-----------------------------------------------------------------------------
                                Example 5
-----------------------------------------------------------------------------

This is another WP example.  This time, however, it runs WP then loads in
a specific file.

begin
select wait 1000 abort
runback "WP:WP"
select Workbench WordPerfect
menu Project " Retrieve" File
select Workbench Retrieve
;; Simulate the user typing "RAM:Test". (replace this with your own filename)
key "RAM:Test"
;; Click on the Accept gadget
gadget Accept


You can easily merge examples 4 and 5 together and make WP load up any
number of files you like!

-----------------------------------------------------------------------------
                                Example 6
-----------------------------------------------------------------------------

Here's a script that'll load Professional Draw, bring up the file requester,
enter the directory and filename and load the file:

begin
select wait 1000 abort
runback "PDraw:PDraw"
select screen "Professional Draw"
wait
menu Project Open
wait
select window "Open Folio"
gadget Drawer "PDraw:Drawings"
wait
gadget File   "HandFlyer"

-----------------------------------------------------------------------------
                                Example 7
-----------------------------------------------------------------------------

Here's another script that'll load Professional Page, and then will create
a new page (ready for work.)

begin
select wait 1000 abort
runback "PDraw:PDraw"
select screen "Professional Draw"
wait
menu Page Create
wait
select window "New Page Format"
gadget OK

-----------------------------------------------------------------------------
Khalid Aldoseri    CIS 75166,2531                             7 October 1989.
-----------------------------------------------------------------------------
