home *** CD-ROM | disk | FTP | other *** search
- /* Sample Plugin for the Enhanced E Editor */
-
- /*==============================================================
- From these plugin files there will be many VisPro/Rexx commands
- that you can use to manipulate text etc in the editor. They must
- be written just like a rexx cmd file which is, in all actuality,
- what they are. :-)
-
- There are two variables that are important for you to use in these
- commands in order to communicate with the editor. "window" is a
- variable that is used as the editors name in your code and
- "Target" is the name of the editor's text window.
-
- The code template tool using "Rexx.ext" will help with many of the
- commands you can use and we will try to make a set of VisPro commands
- available too. Here are a few of the basic ones that are available
- to you.
-
- /* Get first character position Target Multi-Line Entry Field */
- FirstChar=VpItem(window,Target,'SENDMSG','0x01d6')
-
- /* Get selection range Target Multi-Line Entry Field */
- PARSE VALUE VpGetIndex(window,Target) with First Last
-
- /* Get text in range Target Multi-Line Entry Field */
- /* needs the previous call to get the "First" & "Last" variables */
- SelectedText = VpGetItemValue(window,Target,First,Last)
-
- /* Get all text in Target Multi-Line Entry Field */
- Document = VpGetItemValue(window,Target)
-
- /* Select a range the Target Multi-Line Entry Field */
- CALL VpSelect window,Target,First,Last
-
- /* Add item at current location Target Multi-Line Entry Field */
- CALL VpAddItem window, Target, 'CURRENT', value
-
- /* Put up a message box */
- response=VpMessageBox(window,'Your TitleBarText','Your message here')
-
- Look over the supplied examples to see how to use some of these.
- You can cut and paste these commands to help you build your own
- plugins. When you are finished you can delete this whole commented
- area. The example plugin below will lowercase selected text.
- ===============================================================*/
-
- /* Get the range of the selected text */
- Parse Value VpGetIndex(window,Target) with First Last
-
- /* Now read the text from "First" to "Last" */
- SelectedText = VpGetItemValue(window,Target,First,Last)
-
- /* Use the rexx "translate" command to lowercase */
- /* the variable "SelectedText" */
- SelectedText=translate(SelectedText,'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')
-
- /* Now highlight the text from "First" to "Last" */
- /* again just in case someone has unhighlighted */
- /* it while we were away */
- Call VpSelect window,Target,First,Last
-
- /* Adding our variable "SelectedText" to the current */
- /* location will replace the selected text with the */
- /* "translate"d text */
- Call VpAddItem window, Target, 'CURRENT', SelectedText
-
- /* You won't really want to do the following probably */
- /* but it's just another example of what you can do. */
-
- /* Set the titlebar text variable */
- Title="Bob's LowerCase for Selected Text Utility v6.81"
-
- /* Set the message text variables (msg1 msg2 msg3) */
- /* '0d0a'x is hex for a carraige return/line feed */
- msg1="Thanks for using Bob's LowerCase for Selected Text Utility v6.81"||'0d0a0d0a'x
- msg2='Be sure to try my Uppercase and Shotgun Case Utilities which are now in version 7.01 and 12 gauge'
- msg3=' respectively at a store near you...'||'0d0a0d0a'x||'Utterly and Sincerely,'||'0d0a'x||'Bob' '0d0a'x
-
- /* Open the messagebox with the three msg's */
- /* concatenated together with "||" */
- response=VpMessageBox(window,Title,msg1||msg2||msg3)
-
- /* Do another one for the fun of it */
- msg1='BTW: I pretty much had the LowerCasing working since version 1. Since then I have been'
- msg2=' working on these advertising windows.'||'0d0a0d0a'x||'Thanks,'||'0d0a'x||'Bob'
- response=vpmessagebox(window,title,msg1||msg2)
-