home *** CD-ROM | disk | FTP | other *** search
- /*
- ** Rexx-CED_Demo.ced
- **
- ** $Rexx-CED_Demo.ced 1.0.1 (2.6.93)
- **
- ** This script is an example ARexx program for communicating with
- ** CED.
- **
- ** This script requires CygnusEd Professional v3.5 (or later) to run.
- **
- ** Copyright © 1990-1993 ASDG, Incorporated All Rights Reserved
- */
-
-
- CR = '0A'X /* Let's use a shortcut for the "cr" string... */
-
- OPTIONS RESULTS /* want this enabled for OKAY2 testing and other */
- /* commands that return results. */
- ADDRESS "rexx_ced" /* Set the default port name so that commands go to CED. */
-
-
- FirstTextLine = 6
-
- OPEN NEW /* Use the 'Open new' menu command to open up a new project. */
- EXPAND VIEW /* Expand the new view out to full size. */
-
- /* Insert some blank lines. */
- TEXT CR
- TEXT CR
- TEXT CR
-
- /* Print out the title line in a fancy way. */
- TextLine = ' ****** ARexx <-- --> CED Demonstration ******'
-
- DO i = LENGTH( TextLine ) TO 1 BY -1
- BEG OF LINE
- TEXT SUBSTR( TextLine, i, 1 )
- END
-
- 'END OF LINE'
-
- TEXT CR
- 'END OF FILE'
- TEXT CR
-
-
- TEXT 'OKAY1 Command'CR CR
- TEXT 'Command line = OKAY1 "The OKAY1 Command"'CR CR
- TEXT 'This command brings up a requester containing the message you specify'CR
- TEXT 'and returns when the user clicks on the "Continue" button.'CR
- OKAY1 "The OKAY1 Command"
- CALL Clear
-
-
- TEXT 'OKAY2 Command'CR CR
- TEXT 'Command line = OKAY2 "The OKAY2 Command"'CR CR
- TEXT 'This command brings up a requester containing the message you specify'CR
- TEXT 'with "OK" and "Cancel" buttons. It returns when the user clicks on'CR
- TEXT 'one of the buttons and, if you have set results on in ARexx, returns'CR
- TEXT 'a 1 or 0 depending on whether the user clicked on "OK" or "Cancel".'CR CR
- CALL TIME( 'r' )
- OKAY2 "The OKAY2 Command"
- Hold = RESULT /* save the result */
- TEXT 'You took' TIME( 'E' ) 'seconds to respond by selecting the '
- IF (Hold = 1) THEN
- TEXT '"OK"'
- ELSE
- TEXT '"Cancel"'
- TEXT ' button'CR
- CALL Wait(2)
- CALL Clear
-
-
- TEXT 'The TEXT Command'CR CR
- TEXT 'The text command is used to enter a string of ASCII text into the current'CR
- TEXT 'file in CygnusEd. To stop ARexx from uppercasing the text, it should be'CR
- TEXT 'enclosed in quotes. Non-ASCII or control characters can either be'CR
- TEXT 'entered as hex data in ARexx by putting an X after a string of hex data'CR
- TEXT 'or by using the "Enter ASCII" command of CygnusEd. A carriage return must'CR
- TEXT 'be entered at the end of each text line.'CR CR
- TEXT 'Example command:'CR
- TEXT ' TEXT "this is a line." "0a"x"'CR
- TEXT ' would enter...'CR
- TEXT ' this is a line.'CR
- OKAY1 'Paused...'
- CALL Clear
-
-
- TEXT 'The JUMPTO Command'CR CR
- TEXT 'Command line = "JUMPTO 10 i"'CR CR
- TEXT 'This command lets you jump the CygnusEd cursor to a specified line'CR
- TEXT 'and column number position.'CR
- DO i = 10 TO 30
- JUMPTO 10 i
- END
- CALL Wait(2)
- CALL Clear
-
-
- TEXT 'The GETFILENAME Command'CR CR
- TEXT 'Command line = "GETFILENAME "default/file/name""'CR CR
- TEXT 'This command brings up the CygnusEd file requester'CR
- TEXT 'containing whatever default file name you specify. If you have set'CR
- TEXT 'results on in ARexx it returns the file name the user selects, or a NULL'CR
- TEXT 'string if the user selects nothing.'CR CR
- GETFILENAME 'default/file/name'
- IF (RESULT = 'RESULT') THEN
- TEXT 'A NULL string was returned'CR
- ELSE
- TEXT 'The returned string was "'RESULT'"'CR
- CALL Wait(2.5)
- CALL Clear
-
-
- TEXT 'The GETNUMBER Command'CR CR
- TEXT 'Command line = "GETNUMBER 100"'CR CR
- TEXT 'This command brings up the CygnusEd get_a_number requester. The default'CR
- TEXT 'number you specify on the commandline will be in the requester. If you'CR
- TEXT 'have set results on in ARexx this will return whatever number the user'CR
- TEXT 'enters. If the user cancels the requester it will return a NULL string.'CR
- GETNUMBER 100
- Hold = RESULT
- TEXT CR
- IF (Hold = '') THEN
- TEXT 'A NULL was returned'CR
- ELSE
- TEXT 'The number returned was' Hold CR
- CALL Wait(2)
- CALL Clear
-
-
- TEXT 'The ENTER ASCII Command'CR CR
- TEXT 'Command line = "Enter ASCII..."'CR
- TEXT 'CygnusEd will bring up a requester asking you to specify the'CR
- TEXT 'numeric value for the ASCII character you want to enter.'CR CR
- TEXT 'Note where the cursor is located before the command is executed'CR
- TEXT '(10 is the numeric value for a Carrige Return)'
- JUMPTO 9 1
- OKAY1 'Waiting...'
- ENTER ASCII
- CALL Wait(2)
- CALL Clear
-
-
- TEXT "Let's play with the replace command."CR CR CR CR
- TEXT "I'll just put in a bit of sample text. There we are."CR
- TEXT "I'll just put in a bit of sample text. There we are."CR
- TEXT "I'll just put in a bit of sample text. There we are."CR
- CALL Wait(1)
- JUMPTO FirstTextLine + 2
- TEXT "I'm going to replace the string 'sample' with the string 'Replacement'"
- CALL Wait(3)
- Counter = 0
- DO i = 1 TO 3
- REPLACE 'sample' 'Replacement'
- CALL Wait(1)
- END
- 'END OF FILE'
- CALL Wait(2)
- CALL Clear
-
-
- String1 = 'This is '
- String2 = 'the end'
- String3 = ' of the demo.'
- String4 = ' Is this really '
- TEXT ' '
- DO i = 1 TO LENGTH( String1 )
- TEXT SUBSTR( String1, i, 1 )
- END
- DO i = 1 TO LENGTH( String2 )
- TEXT SUBSTR( String2, i, 1 )
- END
- DO i = 1 TO LENGTH( String3 )
- TEXT SUBSTR( String3, i, 1 )
- END
- CALL Wait(2)
- DO i = 1 TO LENGTH( String1 ) + LENGTH( String2 ) + LENGTH( String3 )
- LEFT
- END
- DO i = 1 TO LENGTH( String1 )
- DELETE
- END
- DO i = 1 TO LENGTH( String4 )
- TEXT SUBSTR( String4, i, 1 )
- END
- DO i = 1 TO LENGTH( String2 )
- RIGHT
- END
- DO i = 1 TO LENGTH( String3 )
- DELETE
- END
- TEXT '?'CR
-
- EXIT 0
-
-
- /*
- ** This routine clears from FirstTextLine to the end of the file -- as
- ** this isn't more than twenty lines. A better version would check
- ** to find out when it had reached the end of the file.
- */
-
- Clear:
- JUMPTO FirstTextLine 1
- DO i = 1 TO 20
- DELETE LINE
- END
- RETURN 0
-
-
- /*
- ** This is a function to delay a specified number of seconds.
- */
-
- Wait:
- ARG Delay
- CALL TIME( 'R' )
- DO WHILE (TIME( 'E' ) < Delay)
- NOP
- END
- RETURN 0
-