Back (Home)


Notes on XPL programing and simple macro routines (B.Henderson)

(Download XyWrite Format Version)

This is a page that represents a sort of "cheat sheet" I made for my own use to help me remember how to construct some of the macro routines I use most often. I've attempted to make it usable to those who don't have access to the inside of my head, but even at that, some of the explanations as to why certain routines work the way they do may be inaccurate...even if the routines themselves fuction correctly.

A note about working with Returns:

  1. If you're searching for a return, use the type of return character (white rectangle with hole in the middle) that's found under the CTRL/J key (or whatever key puts the return character on the command line for you).
  2. If a program is placing a return in a document, use the character under the return key (musical note).
  3. If you want to find out if a captured character is equal to (or not) to a return saved in a buffer, the return that's saved must be the "real" save an actual return...not the rectangle or the musical note. (it will look odd because the SV will break after the comma).

Buffer Types

  • SV = save variable (can be multiple characters or digits)
  • PV = put variable (either inside an equation or as text in a file)
  • SX = save string (usually to save the result of some action)
  • IS = insert string (use when comparing contents of buffers)

____ i.e. ____

«SV01,1» = store "1" in the 01 buffer

«PV01» = call "1" from buffer 01

«SX01,«PV01»+«PV02»» = Add contents of 01 and 02.
01 now contains the resulting sum.

«IF«IS01»==«IS02»» = If buffer 01 equals buffer 02

NOTE: For some reason, IS only seems to work when using "==". When using "+", "<", or ">" use PV.

If equals:


If less than:


This piece is for IF/ERROR routing

«IF«ER»»«GL1»«EI»«GL2» = If error, goto label 1 - otherwise, goto label 2.

This piece is for yes/no - and/or routing


«LBB»BC (Y)es/(N)o ?GT  «SX66,«RC»»«SX66,@UPR(«IS66»)»«GLC»

«LBC»«IF«IS66»==«IS11»»«GLE»«EI»«GLD» = If "Y" goto label E

«LBD»«IF«IS66»==«IS22»»«GLF»«EI»«GLB» = If "N" goto label F

«LBE»"Y"es result goes here«EX1»

«LBF»"N"o result goes here«EX1»


If you want more than two choices, modify set-up like this:


«LB2»BCDo (T)his, The (O)Ther or (S)top ?«SX66,«RC»»«SX66,@UPR(«IS66»)»«GL3»

«LB3»«IF«IS66»==«IS11»»«GL6»«EI»«GL4» if This, goto label 6

«LB4»«IF«IS66»==«IS22»»«GL7»«EI»«GL5» if The Other, goto label 7

«LB5»«IF«IS66»==«IS33»»«prPROGRAM STOPPED»«EX1»«EI»«GL2» Stop

«LB6»"T" result goes here«EX1»

«LB7»"O" result goes here«EX1»

This piece is for getting a result from adding numbers together

«SX01,«PV01»+«PV02»» = Buffer 01 now equals 01 + 02


«SX01,«PV02»+«PV03»» = 01 now equals 02 + 03

This piece can repeat an action over and over again until it's finished and then go to the next

«LB_action»Something happens here«IF«ER»»«GL_next»«EI»«GL_action»

Add 1 to a number in a buffer



Buffer 01 now = 2

Capture a string and then perform an action on all strings like it

«LB1»BC  se |waffles |XC  DF  BC  se |.|XC  CL  DF  «SV55»XD  «GL2»

Search for the word "waffles" and the space after it, start define.
Search for period, move cursor to the left of the period and close define.
Save captured string in buffer 55. Release define.

«LB2»TF  BC  ch |«PV55»| are no longer on the menu|XC  «EX1»

To JUMP to marked spot

«LB1»«SX900,«CP»» = save Cursor Position in buffer 900

Note: CP is determind as total character count from beginning of document.


«LB1»«SX01,«CL»» = store Column Location in buffer 01

Note: CL is the column that the cursor is in.

«LB2»BC  JMP «PV900»XC  = send cursor to position saved in buffer 900

Note: CP will seem to "move" backwards if any characters are added to document above marked position.
CL is not affected by this.

Figure out when a string of characters wraps to the next line

«LB1»SP  «GL2» = turn on Line-Count display

«LB2»DF  CR  DF  «SX66, «VA$LN»»XD  «GL3»

«LB3»Perform action, then capture area that might have moved«GL4»

«LB4»DF  CR  DF  «SX99, «VA$LN»»XD  «GL6»


«LB7»BC  «PV99» Is No Longer On The Same LineGT  «EX1»

Search for end of string of capitalized words


«LB10»DF  CR  DF  «SV10»XD  «IF«IS10»==«IS01»»«GL101»«EI»«GL15»

«LB15»«SX11,@UPR(«IS10»)»«GL20» = store in buffer 11 the uppercase version of whatever is currently stored in buffer 10.

«LB20»«IF«IS10»==«IS11»»CR  «GL10»«EI»«GL100»



To put message in the PRompt line


Note: Message will disappear when a key is hit, or if a macro continues to execute.