home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The CDPD Public Domain Collection for CDTV 3
/
CDPDIII.bin
/
pd
/
utilities
/
editors
/
textra
/
scripts
/
tutorial.textra
< prev
next >
Wrap
Text File
|
1993-01-05
|
24KB
|
635 lines
/*******************************************************************
* TEXTRA AREXX script -- Mike Haas, ©1993, All Rights Reserved. *
* Freely distributable ONLY as a component of the TEXTRA package. *
* This banner may not be removed or altered (improvements to the *
* actual program welcome). Please document and send to me. *
* !!! PLACE THIS FILE IN YOUR REXX: DIRECTORY !!! *
*******************************************************************/
/* Tutorial for TEXTRA (v1.13 required)
*
* by Mike Haas
*
* This script is a training aid to give the user a sense of the
* user-interface of the editor.
*
* It accepts one optional argument... if the keyword "delay" is
* supplied, the Tutorial will delay between text pieces spilled
* to the screen as a 'pacing' mechanism.
*
*/
OPTIONS results
rex = 0; result = "NOTSUPPORTED" /*00002*/
textraversion
parse var result maj min rex
if (result == "NOTSUPPORTED") | (rex < 5) then do
notify "Textra 1.13 or later required to run this script."
exit
end
parse arg delay
openfile "ram disk:Textra Tutorial"; tutwin = result
clear
if (tutwin == 0) then do
notify "Can't open the window"
exit
end
prefs autoindent read
wasai = result
prefs autoindent off
quitflag = 0
do while (quitflag == 0)
clear
newline
textn '" Welcome to the Textra Tutorial"'
textn '" =============================="'
newline;newline
textn '" A - All topics in sequence"'
newline
textn '" 1 - Introduction 2 - Provided documentation"'
textn '" 3 - Using the mouse 4 - Positioning the cursor"'
textn '" 5 - Selecting ranges of text 6 - The window scroll bars"'
textn '" 7 - Working with selected text 8 - Textra Preferences"'
textn '" 9 - Textra and Fonts 10 - The ARexx Interface"'
newline
textn '" R - Registration Information"'
newline
textn '" X - Exit tutorial"'
newline;newline
response = getreturn('" Choose a topic: "')
parse var response stx sty endx endy
gotoxy stx sty;selectto endx endy
get select text;parse var result numleft' 'theSelection
if (numleft == 0) then do
if ((theSelection == "A") | (theSelection == "a")) then
call DoSequence
if (theSelection == 1) then
call DoIntro
if (theSelection == 2) then
call DoDocs
if (theSelection == 3) then
call DoMouseInfo
if (theSelection == 4) then
call DoPositionCursor
if (theSelection == 5) then
call DoSelectRanges
if (theSelection == 6) then
call DoScrollBars
if (theSelection == 7) then
call DoSelectTextInfo
if (theSelection == 8) then
call DoPrefs
if (theSelection == 9) then
call DoFonts
if (theSelection == 10) then
call DoARexx
if ((theSelection == "R") | (theSelection == "r")) then
call DoReg
if ((theSelection == "X") | (theSelection == "x")) then do
prefs autoindent wasai
CloseWindow
exit
end
end
end
exit
DoSequence:
call DoIntro
call DoDocs
call DoMouseInfo
call DoPositionCursor
call DoSelectRanges
call DoScrollBars
call DoSelectTextInfo
call DoPrefs
call DoFonts
call DoARexx
call DoReg
return
DoIntro:
clear;wfs=waitforsub(1);newline;newline
textn '" Welcome to TEXTRA V1.13!"'
wfs=waitforsub(2)
newline
textn '" This tutorial is designed to give you a feel for"'
textn '" what Textra can do by guiding you through some of"'
textn '" its basic editing operations and features."'
wfs=waitforsub(2)
newline
textn '" Occasionally, the tutorial will suggest some things"'
textn '" to try. As the editor functions independantly of this"'
textn '" ARexx tutorial, you may try them immediately. Simply"'
textn '" press RETURN when done, as prompted."'
wfs=waitforsub(2)
newline
text '" Like now..."';
wfs=waitforsub(2)
response = getreturn('" Please hit the RETURN key..."')
clear;wfs=waitforsub(1);newline;newline
textn '" What is TEXTRA?"'; newline
newline
wfs=waitforsub(1)
text '" "';textn "It's an easy-to-use, powerful text editor.";
newline
wfs=waitforsub(2)
textn '" A great deal of effort has been put into making the user"';
text '" interface... "';wfs=waitforsub(1);text '"well... "';wfs=waitforsub(1);
textn '"easy-to-use AND powerful."';
newline
wfs=waitforsub(1)
textn '" Working with the Textra menus, keyboard and ARexx scripts"'
textn '" is about the best way to get to know it. Experimentation"'
textn '" (and registering as a Textra user) is heartily encouraged."'
newline
wfs=waitforsub(1)
response = getreturn('" (RETURN to continue)"')
return
DoDocs:
clear;wfs=waitforsub(1);newline
textn '" The Textra Documentation"'
textn '" ------------------------"';newline
wfs=waitforsub(1.5)
textn '" Please refer to the Textra.doc file (in the docs drawer)"'
textn '" for detailed information about all editor features and"'
textn '" facilities."'
newline;wfs=waitforsub(1)
textn '" If you are interested in programming your own Textra-"'
textn '" Arexx scripts, the RexxCommand.doc file (also in docs)"'
textn '" describes the Textra-resident command set."'
newline;wfs=waitforsub(1)
textn '" For previous Textra users, the complete change history"'
textn '" contained in WhatsNew.doc (same place) may be of interest."'
newline;wfs=waitforsub(1)
textn '" Finally, a list of known gotchas is listed in a file"'
textn '" called zKnownProblems.doc (which has shrunk to just"'
textn '" about nothing! Yay!)."'
newline;wfs=waitforsub(1)
response = getreturn('" (RETURN to continue)"')
return
DoMouseInfo:
clear;wfs=waitforsub(1);newline;newline
textn '" Use of the mouse in Textra"'
textn '" --------------------------"';newline
wfs=waitforsub(1.5)
textn '" The LEFT MOUSE BUTTON is used primarily to either..."';newline
wfs=waitforsub(2)
textn '" 1. Position the text cursor (topic 4)"';wfs=waitforsub(1)
textn '" 2. Establish a select range (topic 5)"';wfs=waitforsub(1)
textn '" 3. Control the window scroll bars (topic 6)"'
newline;newline;wfs=waitforsub(2)
text '" "';textn "The RIGHT MOUSE BUTTON is used to access Textra's"
textn '" Amiga-standard menus."'
newline
response = getreturn('" (RETURN to continue)"')
return
DoPositionCursor:
clear;wfs=waitforsub(1);newline;newline
textn '" Positioning the cursor"'
textn '" ----------------------"';newline
wfs=waitforsub(1.5)
textn '" The Textra cursor is a vertical bar that always"'
textn '" lies on the extreme left edge of the character"';
textn '" position it is occupying."';newline
response = getreturn('" (RETURN to continue)"')
gotoxy 0 5;
selectto 0 10
textn '" While pointing the mouse pointer at some word on"'
textn '" this page, Single-Click the LEFT MOUSE BUTTON..."';newline
response = getreturn('" (Do that several times, then RETURN to continue)"')
gotoxy 0 5;
selectto 0 9
textn '" Place the cursor in the middle of a line, then"'
textn '" experiment with the keyboard arrow-keys..."';newline
response = getreturn('" (When finished, press RETURN to continue)"')
return
DoSelectRanges:
clear;wfs=waitforsub(1);newline;newline
textn '" Selecting a Range of Text"'
textn '" -------------------------"'
newline
wfs=waitforsub(1.5)
textn '" Any contiguous series of characters may be SELECTED"'
textn '" in a variety of ways. As you will later see, such"'
textn '" a SELECT RANGE may be used as a single object; it may"'
textn '" be CUT, COPIED, PASTED, passed to ARexx scripts"'
textn '" and more."';
newline
wfs=waitforsub(2)
textn '" This section illustrates several methods of"'
textn '" SELECTING TEXT..."';newline
response = getreturn('" (Press RETURN to continue)"')
gotoxy 0 5;
selectto 0 15
textn '" While pointing the mouse pointer at some word on"'
textn '" this page, DOUBLE-Click the LEFT MOUSE BUTTON..."';newline
response = getreturn('" (Do that several times, then RETURN to continue)"')
gotoxy 0 5;
selectto 0 9
textn '" Now try TRIPLE-Clicking the LEFT MOUSE BUTTON on a line..."';newline
response = getreturn('" (Do that several times, then RETURN to continue)"')
gotoxy 0 5;
selectto 0 8
textn '" Place the cursor over some word, then press & hold the"'
textn '" LEFT MOUSE BUTTON. Then move the mouse around a little"'
textn '" and finally let the LEFT MOUSE BUTTON up."'
newline
response = getreturn('" (Do that several times, then RETURN to continue)"')
gotoxy 0 5;
selectto 0 10
textn '" Wherever the cursor is at the moment, move the mouse"'
textn '" pointer such that it is over some other word. Then,"'
textn '" while holding down a SHIFT key, Single-click the LEFT"'
textn '" MOUSE BUTTON."'
newline
response = getreturn('" (Do that several times, then RETURN to continue)"')
return
DoScrollBars:
clear;wfs=waitforsub(1);newline;newline
textn '" Controlling the Window Scroll Bars"'
textn '" ----------------------------------"';newline
wfs=waitforsub(1.5)
textn '" Every Textra window includes vertical and horizontal"'
textn '" scroll bars which become active as soon as text"'
textn '" exceeds the visible window dimensions in either"'
textn '" direction."'
newline;wfs=waitforsub(1.5)
textn '" They afford continuous scrolling in the appropriate"'
textn '" direction to make all text visible. Also, there are"'
textn '" times when Textra will scroll by itself (such as when"'
textn '" you try to type off the edge of the window) and the"'
textn '" scroll bars will reflect such changes."'
newline;wfs=waitforsub(1)
response = getreturn('" (RETURN to continue)"')
gotoxy 0 5;
selectto 0 17
text '" Observe the horizontal scroll bar below..."'
waitfor 1
text '" as this line..."';waitfor 1;text '" gets "';waitfor 1;
text '" longer "';waitfor 1;text '" and "';waitfor 1;text '" longer..."'
waitfor 2;newline;newline;wfs=waitforsub(2)
textn '" The above line is longer than the window is wide,"'
textn '" and the horizontal scroll bar reflects that."';newline
wfs=waitforsub(1.5)
textn '" Go ahead and click on the scroll bar components"'
textn '" (arrows, slider, non-slider), drag the slider"'
textn '" around, get a feel for the horizontal window control..."'
newline;wfs=waitforsub(1)
response = getreturn('" (Press RETURN when finished experimenting)"')
gotoxy 0 5;
selectto 0 15
textn '" Lets illustrate both scroll bars in action..."';newline
wfs=waitforsub(1.5)
textn '" This window will soon fill with enough text such"'
textn '" that both scroll bars will activate."';newline
wfs=waitforsub(1.5)
textn '" Once it does, play with both scroll bars, moving the"'
textn '" text around. When finished experimenting, press"'
textn '" RETURN."';newline
wfs=waitforsub(1.5)
get cursor position; parse var result cx cy;
response = getreturn('" (Press RETURN to activate both scroll bars)"')
gotoxy 0 cy;selectto 0 cy+1
del
newline;newline;newline;newline;
textn '" Four score and seven years ago, our forefathers brought forth upon this continent"'
textn '" a new nation, dedicated to the proposition that all men are created equal. We hold"'
textn '" these truths to be self-evident..."';newline;newline;newline
response = getreturn('" (Press the RETURN key when finished experimenting)"')
return
DoSelectTextInfo:
clear;wfs=waitforsub(1);newline;newline
textn '" Working with selected ranges of text"'
textn '" ------------------------------------"';newline
wfs=waitforsub(1.5)
textn '" Once a section of text is SELECTED (see topic 5),"'
textn '" it may be CUT, or COPIED into a Textra internal buffer."'
textn '" It is then a simple matter to re-position the cursor"'
textn '" to another location (perhaps even in a different"'
textn '" Textra window), and PASTE that text there."';newline
wfs=waitforsub(1.5)
textn '" To illustrate, select any section of text in the"'
textn '" preceeding paragraph, then press Right-Amiga-C (copy)."'
textn '" Position the cursor just past the paragraph and press"'
textn '" Right-Amiga-V (paste)."'
newline;wfs=waitforsub(1)
response = getreturn('" (Press RETURN when finished)"')
clear;newline;newline
textn '" Working with SELECTED RANGES of text"'
textn '" ------------------------------------"';newline
wfs=waitforsub(1.5)
textn '" When a SELECT RANGE exists, the DEL and BACKSPACE keys"'
textn '" on the keyboard work similar to the CUT operation,"'
textn '" except that the removed text is NOT saved in the"'
textn '" internal Textra buffer."'
newline;wfs=waitforsub(1)
response = getreturn('" (Press RETURN to continue)"')
return
DoPrefs:
clear;wfs=waitforsub(1);newline;newline
textn '" Textra Preference Settings"'
textn '" --------------------------"';newline
wfs=waitforsub(1.5)
textn '" Textra provides a set of user-configurable Preference"'
textn '" settings which can be saved to disk such that they will"'
textn '" be re-assumed whenever Textra starts-up."'
newline;wfs=waitforsub(1.5)
textn '" Optionally, these settings may be invoked temporarily"'
textn '" without being saved to disk."'
newline;wfs=waitforsub(1.5)
textn '" The settings are grouped into 3 areas of use:"'
newline;wfs=waitforsub(1)
textn '" 1. Printing Preferences"';wfs=waitforsub(1)
textn '" 2. Editing Preferences"';wfs=waitforsub(1)
textn '" 3. Font Preferences"';wfs=waitforsub(1)
newline;wfs=waitforsub(1.5)
response = getreturn('" (Press RETURN to continue)"')
clear;wfs=waitforsub(1);newline;newline
textn '" Textra Printing Preferences"'
textn '" ---------------------------"'
newline;wfs=waitforsub(1.5)
textn '" Under the Project menu is the Printing Preferences... item."'
textn '" Pull it down now and observe the various settings available."'
textn '" Then press the CANCEL button on the requester."'
newline;wfs=waitforsub(1.5)
textn '" Refer to Textra.doc for more information about any of the"'
textn '" available Printing Preference settings."'
newline;wfs=waitforsub(1.5)
response = getreturn('" (When finished, press RETURN to continue)"')
clear;wfs=waitforsub(1);newline;newline
textn '" Textra Editing Preferences"'
textn '" --------------------------"'
newline;wfs=waitforsub(1.5)
textn '" Under the Edit menu is the Editing Preferences... item."'
textn '" Pull it down now and observe the various settings available."'
textn '" Then press the CANCEL button on the requester."'
newline;wfs=waitforsub(1.5)
textn '" Refer to Textra.doc for more information about any of the"'
textn '" available Editing Preferences."'
newline;wfs=waitforsub(1.5)
response = getreturn('" (When finished, press RETURN to continue)"')
clear;wfs=waitforsub(1);newline;newline
textn '" Textra Font Preferences"'
textn '" -----------------------"'
newline;wfs=waitforsub(1.5)
textn '" Under the Utilities menu is the Font Preferences... item."'
textn '" This item will be enabled if the asl.library (usually"'
textn '" associated with WB2.0 and later) is available on your"'
textn '" system."'
newline;wfs=waitforsub(1.5)
textn '" Currently, the only save-able Preference setting is"'
textn '" the specification of which font to use for newly-opened"'
textn '" Textra windows."'
newline;wfs=waitforsub(1.5)
textn '" If enabled, pull it down now and experiment. Then press"'
textn '" the CANCEL button on the requester."'
newline;wfs=waitforsub(1.5)
response = getreturn('" (When finished, press RETURN to continue)"')
return
DoFonts:
clear;wfs=waitforsub(1)
text '" "';textn "Textra's use of fonts"
textn '" ---------------------"';newline
wfs=waitforsub(1.5)
textn '" Every Textra window may have a different fixed-space"'
textn '" font. Under the Utilities... menu is the Set Window"'
textn '" Font item. This item will be enabled if the asl.library"'
textn '" (usually associated with WB2.0 and later) is available"'
textn '" on your system."'
newline; wfs=waitforsub(1.5)
textn '" Feel free to experiment with it now. When finished,"'
textn '" you should set the Tutorial window to Topaz8 or equiv-"'
textn '" alent, where the page-formatting routines of this"'
textn '" tutorial work best."'
newline;wfs=waitforsub(1)
textn '" As an alternative, you could pull down the Project menu,"'
textn '" Open New File item which will give you a new window to"'
textn '" type some text into and change fonts with. If you do so,"'
textn '" just come back to this window when done. Then..."'
newline;wfs=waitforsub(1)
response = getreturn('" (RETURN to continue)"')
return
DoARexx:
clear;wfs=waitforsub(1);newline
textn '" The Textra-ARexx Interface"'
textn '" --------------------------"'
newline;wfs=waitforsub(1.5)
textn '" Almost sounds like a new TV Space show, eh?"'; newline
textn '" Textra opens an ARexx port called (appropriately) TEXTRA."'
textn '" The resident 40+ command set provides a range of features:"'
newline
textn '" ...from manipulating window text... to window and file"'
textn '" management... interactivity with the TEXTRA user..."'
newline
textn '" (this tutorial, remember, is but a Textra-ARexx script)"'
newline;wfs=waitforsub(1.5)
textn '" Refer to Textra.doc for information on running scripts."'
newline;wfs=waitforsub(1.5)
textn '" Refer to RexxCommand.doc for information on writing scripts."'
newline;wfs=waitforsub(1.5)
response = getreturn('" (Press RETURN to continue)"')
gotoxy 0 4;
selectto 0 19
textn '" The Textra package also includes 25+ ARexx scripts that"'
textn '" are quite varied in scope. Heres an example... say"'
textn '" you hastily type in the following angry note:"'
newline;wfs=waitforsub(1.5)
textn '" Dear cBS News,"'
newline
textn '"I am writing to say I am simply APPALLED at the"'
textn '" manner in which you dress Mr. Rathernot of your evening news!"'
newline
textn '" I am tempted to boycott your presentation"'
textn '" until he"'
textn '" is attired in the manner we have all come accustomed"'
textn '" to expect him... in a Neru jacket."'
newline;newline;wfs=waitforsub(1.5)
response = getreturn('" (Press RETURN to continue)"')
gotoxy 0 4
selectto 0 5;del;selectto 0 5;del;selectto 0 5;del;
gotoxy 0 16;selectto 0 17;del
wfs=waitforsub(1.5)
get cursor position;parse var result cx cy
textn '" By use of the command: paragraph 8 4 60, one can"'
textn '" easily reformat each paragraph..."'
newline;wfs=waitforsub(1.5)
response = getreturn('" (Press RETURN to see what that does)"')
gotoxy 0 cy;selectto 0 cy+4;del
wfs=waitforsub(1.5)
gotoxy 0 7;wfs=waitforsub(1)
selectto 0 8;wfs=waitforsub(0.5)
selectto 0 9;wfs=waitforsub(0.5)
selectto 0 10;wfs=waitforsub(0.5)
selectto 0 11;wfs=waitforsub(0.5)
selectto 0 12;wfs=waitforsub(0.5)
selectto 0 13;wfs=waitforsub(0.5)
selectto 0 14;wfs=waitforsub(0.5)
paragraph 8 4 60
newline;newline;newline;wfs=waitforsub(2.0)
response = getreturn('" (Press RETURN to continue)"')
return
DoReg:
clear;wfs=waitforsub(1);newline;newline
textn '" Textra Registration Information"'
textn '" -------------------------------"'
newline;wfs=waitforsub(1)
textn '" I hope you find Textra a professional-quality text editor."'
textn '" Many suggestions from users have gone into Textra which"'
textn '" have helped it to become a popular tool."'
newline;wfs=waitforsub(1.5)
textn '" Many important features have been added to the Shareware"'
textn '" versions... this version sports undo, multi-processing,"'
textn '" ASL font support, ARexx control of windows and files,"'
textn '" full ARexx interactivity with the user, and much more..."'
textn '" none of which exists in the older freeware versions."'
newline;wfs=waitforsub(1.5)
response = getreturn('" (Press RETURN to continue)"')
gotoxy 0 5;
selectto 0 16
textn '" The registration fee for Textra is $25.00. You will"'
textn '" receive the latest version (probably newer than the"'
textn '" one you are using here). Instead of the 60 second"'
textn '" delay screens, it displays a short 2.5-second registra-"'
textn '" tion notice (personalized to you), which can be closed"'
textn '" earlier via its OK button if desired."'
newline;wfs=waitforsub(1.5)
textn '" Registered users may ask for updates anytime for $5 (or"'
textn '" include your own SASE+floppy). Generally, it is best to"'
textn '" wait at least 6 months before doing so."'
newline;wfs=waitforsub(1.5)
response = getreturn('" (Press RETURN to continue)"')
gotoxy 0 5;
selectto 0 17
textn '" If you are a JForth Professional 3.x owner and registered"'
textn '" with Delta Research, I will register you for free. Just"'
textn '" drop me a line and include your JForth serial number."'
newline;wfs=waitforsub(1.5)
textn '" The serial number appears on the back of the original"'
textn '" JForth Extras disk, and is available by typing into JForth:"'
newline
textn '" SERIAL# ?"'
newline;wfs=waitforsub(1.5)
textn '" This version of Textra will work fine as a substitute for"'
textn '" the V1.11 that comes with JForth."'
newline;wfs=waitforsub(1.5)
response = getreturn('" (Press RETURN to continue)"')
gotoxy 0 5;
selectto 0 18
cut
waitfor .5
textn '" Textra is written in JForth Professional 3.1"'
newline
textn '" Mike Haas"'
textn '" 3867 La Colina Rd."'
textn '" El Sobrante, CA. 94803"'
newline;newline
get cursor position;parse var result cx cy
waitfor 1
text '" "';textn "THERE'S A TEXTRA WAITING FOR YOU"
i = 0
do while (i < 3)
waitfor 0.5
gotoxy 16 cy;selectto 48 cy
waitfor 0.5
unselect;right 1
i = i+1
end
prefs AlphanumericHops read;ahops = result
prefs AlphanumericHops off
gotoxy 0 cy
i = 0
do while (i < 6)
waitfor 0.1
hopselect next word
i = i+1
end
i = 0
do while (i < 5)
waitfor 0.1
hopselect prev word
i = i+1
end
i = 0
do while (i < 5)
waitfor 0.1
hopselect next word
i = i+1
end
i = 0
do while (i < 1)
waitfor 0.1
hopselect prev word
i = i+1
end
prefs AlphanumericHops ahops
down 2
/*
THERE'S A TEXTRA WAITING FOR YOU
*/
newline;newline;wfs=waitforsub(1.5)
response = getreturn('" (press RETURN to continue)"')
return
DoByeBye:
prefs autoindent wasai
notify "end of script"
exit
return
getreturn:
parse arg theprompt
checkcancel
if (result == CANCEL) then do
notify "Aborting"
prefs autoindent wasai
exit
end
returnprompt theprompt
return result
waitforsub:
parse arg wfval
if (delay == "delay") then
waitfor wfval
return wfval