home *** CD-ROM | disk | FTP | other *** search
/ Fish 'n' More 2 / fishmore-publicdomainlibraryvol.ii1991xetec.iso / dirs / uedit-stuff_429.lzh / Uedit-Stuff / BBSing < prev    next >
Text File  |  1991-01-10  |  17KB  |  381 lines

  1. We have here some Uedit commands useful for BBSing.  We've got things do
  2. quote text with a marker at the start of each line, like this:
  3.  
  4.  PK> Well blah blah blah blah blah, and blah
  5.  PK> blah blah blah...
  6.  
  7. and we've got functions for using Uedit to edit messages online and send text
  8. back and forth with Rexx.  The versions given here work with BaudBandit 1.00
  9. and 1.50, and VLT 4.824, and it shouldn't be hard to get them to work with
  10. other Rexx-compatible terminals.
  11.  
  12. The way mine is set up is, there's a function key in BaudBandit which saves
  13. the review buffer in ram disk and then runs a Rexx file called "Cap2Uedit",
  14. which makes Uedit (if auto-traffic is on) load in that capture file and show
  15. the last page of it.  That script also sends characters out the modem every
  16. few seconds to keep the bbs on the other end from hanging up on you.  You
  17. then compose your message in Uedit, using the quoting commands mentioned
  18. above, and then press rAmiga-7, which saves the current buffer, pads its
  19. empty lines with spaces, and causes BaudBandit to ascii-send it.  The general
  20. procedure is to give the bbs commands to reply and wait until it is actually
  21. waiting for you to type in the message before you press the Cap2Uedit
  22. function key.  That key is defined with the string "\av\mCap2Uedit" in
  23. BaudBandit.  Then you compose your reply and press rAmiga-7 to send it. 
  24. While you are composing it, Cap2Uedit is sending space-backspace out the
  25. modem every ten seconds.
  26.  
  27. After five minutes it will make a noise (using the Play8SVX program - remove
  28. these lines if you don't have it or don't want to use it) to remind you that
  29. you're still on the phone.  It will stop sending space-backspaces if you
  30. press another function key defined as "\mShutup-Cap2Uedit".  NOTE that
  31. BaudBandit cannot exit if any rexx script it started is still running.  If
  32. you tell it to quit and it doesn't, try using the Shutup-Cap2Uedit macro and
  33. see if it quits then.  Or you could use amiga-B "Stop ARexx" but it might
  34. respond sluggishly.
  35.  
  36. Files named Cap2Uedit.baud, Cap2Uedit.vlt, and Shutup-Cap2Uedit.baud should
  37. be included with this file.  The VLT version of Shutup-Cap2Uedit is identical
  38. to the BaudBandit version (just rename it with the ending .vlt); the
  39. Cap2Uedit program differs slightly between the two.  There should also be a
  40. file called MessageSend.vlt, which is needed to use rAmiga-7 with VLT. 
  41. BaudBandit does not need a MessageSend program.  All of these .baud or .vlt
  42. files, whichever set is appropriate for the terminal you are using, should go
  43. in your REXX: directory.  The Cap2Uedit scripts also require a RunBack
  44. program if you want them to be able to start Uedit if it is not already
  45. running when you use them.
  46.  
  47. In order for this to work with the Zimmerman auto-traffic interface, you have
  48. to create an auto-traffic command in your REXXCOMM file called LOADCAPTURE
  49. that runs the key virtual-f7 (macronum 1126) given below.  You should also
  50. have a FRONTSCREEN command that runs virtual-1 (macronum 1041) given below,
  51. but that can be left out if you remove the line that uses it from the
  52. Cap2Uedit file.  See the notes below on virtual-1, because it won't work very
  53. well unless your system is set up properly.  Some of the advice for virtual-1
  54. will benefit many other programs as well.
  55.  
  56. My version of Cap2Uedit is also set up to tell Uedit to use an IBM font,
  57. using the SETFONT rexx command.  Naturally this only works with Uedit 2.6a or
  58. newer.  If you use SETFONT you don't actually need FRONTSCREEN because
  59. SETFONT reopens Uedit's screen anyway.  An appropriate IBM font (one with the
  60. first four characters missing because of a problem in Uedit) is included.
  61. Put this in REXXCOMM:
  62.  
  63. loadcapture     1126+0 |
  64. frontscreen     1041+0 |
  65. setfont         995+0 |
  66.  
  67.  
  68. I have just tested the stuff with BaudBandit 1.50, and it works fine except
  69. that whenever you send the review buffer to Uedit it writes "RAM:Capture
  70. Written" (or whatever filename you use) on the screen.  This "feature" was
  71. not present in BB 1.00.  To shut it up, you'll have to do what I did:  Find
  72. the word at byte offset 10830 (hex 2A4E) in the BaudBandit file.  It should
  73. be hex 4878.  Change it to 6010.  Then move to offset 10876 (hex 2A7C).  It
  74. should be 41FA.  Change it to 6006.  If the two existing values are not 4878
  75. and 41FA, then you may have a slightly different version; DO NOT change the
  76. values unless both of the old ones are as described.
  77.  
  78. One other hint for using BaudBandit with IBM character sets in color:  use
  79. FED to change the IBM font you're using so that it is marked as boldface. 
  80. Save the "8b" font and delete the regular "8" non-boldface one.  Otherwise
  81. half the text you get from a color bbs will be boldfaced, which if you had a
  82. 16 color screen would be activating the other 8 colors.
  83.  
  84. ======================
  85.  
  86. So here are some BBSing functions:
  87.  
  88.  
  89. Remove all ANSI escape sequences and backspaces from buffer
  90. <alt-7: putmsg("crunch...")
  91.         equatenum(n54, searchCaps)
  92.         equatenum(searchCaps, 1)
  93.         movecursor(curfile, sfile)
  94.         insertchar(curfile, eline)
  95.         movecursor(curfile, schar)
  96.         setgrep("/\[[0-9;]*[A-FHL]/ /")
  97.         .. the above matches ANSI commands that move the cursor, and replaces
  98.         .. them with a space so words separated by them don't run together
  99.         while (grep(curfile, invert, 2)) nothing
  100.         movecursor(curfile, sfile)
  101.         setgrep("/\[[0-9;]*:a//")
  102.         .. the above matches any ANSI escape sequence
  103.         while (grep(curfile, invert, 2)) nothing
  104.         movecursor(curfile, sfile)
  105.         setgrep("/.:b//")
  106.         while (grep(curfile, invert, 2)) movecursor(curfile, schar)
  107.         .. with that we remove each backspace and the character before it
  108.         movecursor(curfile, sfile)
  109.         clearchar(curfile)
  110.         putmsg(" ")
  111.         equatenum(searchCaps, n54)
  112. >
  113.  
  114.  
  115. Turn off trueTabs in curfile with no side effects
  116. <virtual-f5:    push(buf99, buf50)      .. 2.6 version
  117.                 push(n99, n50)          .. 2.6 version
  118. ....            push(buf50)             .. PRE-2.6 VERSION
  119. ....            push(n50)               .. PRE-2.6 VERSION
  120.                 insertchar(buf50, "-")          .. make it exist
  121.                 equatenum(n50, 0)
  122.                 if (getflag(buf50, truetabs)) equatenum(n50, 1)
  123.                 if (getflag(curfile, truetabs)) {
  124.                     flipflag(curfile, truetabs)
  125.                     if (eqnum(n50, 1)) {
  126.                         flipflag(buf50, truetabs)       .. upflag no work
  127.                         flipflag(buf50, truetabs)
  128.                     }
  129.                 }
  130.                 freebuf(buf50)
  131.                 pop(n99, n50)           .. 2.6 version
  132.                 pop(buf99, buf50)       .. 2.6 version
  133.                 pop(n50)                .. PRE-2.6 VERSION
  134.                 pop(buf50)              .. PRE-2.6 VERSION
  135. >
  136.  
  137. Turn off trueTabs in curfile with no side effects
  138. *** UEK VERSION (more efficient) ....... <virtual-f5:
  139.                 push(n99, n0)           .. 2.6 version
  140.                 push(n99, n1)           .. 2.6 version
  141. ....            push(n0)                .. PRE-2.6 VERSION
  142. ....            push(n1)                .. PRE-2.6 VERSION
  143.                 getaddress(37, n0)              .. &curBuf
  144.                 peek(n0, n0, 4)                 .. curBuf
  145.                 add(n0, n0, 168)                .. &curBuf->Flags
  146.                 peek(n0, n1, 2)                 .. Flags value
  147.                 and(n1, n1, 0xfffe)             .. mask off trueTabs
  148.                 poke(n0, n1, 2)
  149.                 pop(n99, n1)            .. 2.6 version
  150.                 pop(n99, n0)            .. 2.6 version
  151. ....            pop(n1)                 .. PRE-2.6 VERSION
  152. ....            pop(n0)                 .. PRE-2.6 VERSION
  153. >
  154.  
  155.  
  156. The idea of this here command is to paste in a block of text as a bbs quote,
  157. with XX> (initials or whatever) at the beginning of each line.  After you cut
  158. or copy hilite from somewhere, it inserts that text at the cursor.  It
  159. reformats all paragraphs in the freshly pasted hilite region, and (for the
  160. present) keeps the right margin down to 71 at the most including the string
  161. it adds to the beginning of each line, which it asks for each time (default
  162. is "> ").
  163.  
  164. Someday I want to make this so that any line shorter than about rightmargin
  165. minus 20 does not get reformatted.
  166.  
  167. We also someday want a command to strip the existing leading whatever and
  168. then do something like this.  We also want a function to reformat paragraphs
  169. where each line begins with a comment indicator such as "; ", for programming
  170. use.  These could all use common routines?
  171.  
  172. THIS USES N48 as a flag to tell it whether to reformat paragraphs inside the
  173. quote.  By default it does.  It is here set up to clear n48 whenever it's
  174. run, so that the command which sets n48 (rAmiga-6) has to be used before each
  175. unformatted quoting.  To change, just search for n48 ... it's in L-q and R-6.
  176. Warning: some of the spell-checking functions (at least the last versions
  177. I've seen) randomly trash n48 and n49.
  178.  
  179. Paste hilite as bbs-style quote; XX> before each line
  180. <lamiga-q:      if (isempty(buf47)) {
  181.                     putmsg("Cut or copy a hilite region first.")
  182.                     returnfalse
  183.                 }
  184.                 runkey(virtual-kpdot)
  185.                 freebuf(buf54)
  186.                 insertrgn(buf54, efile, "> ", all)
  187.                 movecursor(buf54, sfile)
  188.                 putmsg(
  189. "What should I put at the beginning of each line?  (keep it short)")
  190.                 inputstring(buf54)
  191.                 filesize(buf54, n54)
  192.                 if (getflag(curfile, truetabs))
  193.                     runkey(virtual-f5)
  194.                 getlocal(curfile, n50, linelength)
  195.                 equatenum(n51, n50)
  196.                 if (gtnum(n51, 71)) equatenum(n51, 71)
  197.                 sub(n51, n51, n54)
  198.                 if (gtnum(20, n51)) {           .. 20 is arbitrary
  199.                     alertuser("Leading string too long.  Get real.")
  200.                     returnfalse
  201.                 }
  202.                 runkey(normal-kpenter)
  203. .. shft-kpenter for me because I use normal-kpenter for a normal newline key
  204.                 setlocal(curfile, linelength, n51)
  205.                 movecursor(curfile, ehilite)
  206.                 if (not is(curfile, eline)) insertchar(curfile, eline)
  207.                 insertchar(curfile, eline)
  208.                 movecursor(curfile, shilite)
  209.                 if (not is(curfile, sline)) {
  210.                     insertchar(curfile, eline)
  211.                     incloc(curfile, shilite)
  212.                 }
  213.                 insertchar(curfile, eline)
  214.                 if (eqnum(n48, 0)) {
  215.                     while (gtloc(curfile, ehilite, atcursor))
  216.                         runkey(ctl-3)
  217.                 } else
  218.                     equatenum(n48, 0)
  219.                 movecursor(curfile, shilite)
  220.                 movecursor(curfile, echar)
  221.                 while (gtloc(curfile, ehilite, atcursor)) {
  222.                     insertrgn(curfile, atcursor, buf54, all)
  223.                     movecursor(curfile, downline)
  224.                     if (not is(curfile, sline))
  225.                         movecursor(curfile, sline)
  226.                 }
  227.                 movecursor(curfile, shilite)
  228.                 clearchar(curfile)
  229.                 movecursor(curfile, ehilite)
  230.                 clearchar(curfile)
  231.                 setlocal(curfile, linelength, n50)
  232.             ... setlocal(curfile, linelength, 71)       .. my own preference
  233. >
  234.  
  235. Cause next bbs-style quote to not reformat paragraphs
  236. <ramiga-6:      equatenum(n48, 1)
  237.                 putmsg("Next BBS-style quote will be unformatted.") >
  238.  
  239. Drag mouse to make bbs-style quote in file "t:reply"
  240. <ramiga-buttondown:     runkey(shftaltctl-buttondown)
  241.                         runkey(normal-kpdot)
  242.                         freebuf(buf50)
  243.                         insertrgn(buf50, efile, "t:Reply", all)
  244.                         if (not runkey(virtual-f6)) {
  245.                             if (not newfile) returnfalse
  246.                             setfilename(curfile, buf50)
  247.                         }
  248.                         runkey(lamiga-q)
  249. > ... just a package for convenience
  250.  
  251.  
  252. Find a file buffer by name (supply name in buf50)
  253. <virtual-f6:    getmaxfiles(n54)
  254.                 decnum(n54)
  255.                 do (n53, 0, n54) {
  256.                     if (getfilename(buf54, buf[n53])
  257.                                  & stringcomp(n50, buf54, buf50, 1)) {
  258.                         editbuf(buf[n53])
  259.                         returnTrue
  260.                     }
  261.                 }
  262.                 returnFalse
  263. >
  264.  
  265. Rexx: load in a named capture file and show last page
  266. <virtual-f7:    freebuf(buf50)
  267.                 insertrgn(buf50, sfile, buf61, all)
  268.                 if (runkey(virtual-f6)) freebuf(curfile)   .. flush old copy
  269.                 loadfile(buf50)
  270.                 movecursor(curfile, efile)
  271.                 vscroll(atcursor)               .. BUG WORKAROUND
  272.                 movecursor(curfile, spage)
  273.                 vscroll(atcursor)
  274.         ..      vscroll(2)                      .. fine tuning
  275. ....            if (isempty(buf0) & !eqnum(curfile, 0))
  276. ....                freebuf(buf0) $              .. something I like to add
  277.                 equatenum(n51, curfile)
  278.                 freebuf(buf50)
  279.                 insertrgn(buf50, efile, "t:reply", all)
  280.                 if (runkey(virtual-f6)) {               .. flush old copy
  281.                     freebuf(curfile)
  282.                     editbuf(buf[n51])
  283.                 }
  284. >
  285.  
  286. Pad all empty lines with one space
  287. <alt-6:         putmsg("padding empty lines")
  288.                 equateloc(curfile, mouseloc, atcursor)
  289.                 movecursor(curfile, sfile)
  290.                 while (not is(curfile, efile)) {
  291.                     if (is(curfile, eline))
  292.                         insertchar(curfile, " ")
  293.                     else movecursor(curfile, eline)
  294.                     movecursor(curfile, echar)
  295.                 }
  296.                 putmsg(" ")
  297. >
  298.  
  299. Send Uedit's screen to the front
  300. <virtual-1:     execute(" ", "endif") >
  301.  
  302.   for the above to work at all efficiently, you must make C:Run resident and
  303.   be using SetPatch from AmigaDOS 1.3.2 or newer.  Otherwise it will load the
  304.   Run program from disk every time you call it.  You should do so anyway,
  305.   because otherwise ANY program that uses the AmigaDOS Execute() function to
  306.   run other programs will be very inefficient.  Also you should either make
  307.   C:Endif resident and use AmigaShell (make L:Shell-Seg resident), or copy
  308.   the endif program into ramdisk and change the command above to "ram:endif".
  309.   Or you could call it "ram:DoNothing" or something because the endif program
  310.   literally does nothing at all.  Otherwise it will load c:Endif from disk. 
  311.   With everything resident virtual-1 will run in about a tenth of a second,
  312.   moving Uedit's screen to the back and then back to the front.  REMEMBER,
  313.   EVEN IF YOU NEVER MAKE ANYTHING ELSE RESIDENT, DO make C:Run resident, and
  314.   use SetPatch 1.3.2 or newer.
  315.  
  316.  
  317. Cause BaudBandit to ascii-send current buffer, fix empty lines
  318. <ramiga-7:      runkey(alt-6)                           .. pad empty lines
  319. .. the runkey(alt-6) is necessary with BaudBandit but not VLT.
  320.                 if (getflag(curfile, changed)) {
  321.                     putmsg("saving")
  322.                     if (not savefile(curfile)) {
  323.                         putmsg("CANNOT SAVE BUFFER")
  324.                         returnfalse
  325.                     }
  326.                     getstacksize(n0, n0, n50)
  327.                     while (gtnum(n50, 0)) {     .. wait for save to complete
  328.                         delay(1)
  329.                         getstacksize(n0, n0, n50)
  330.                     }
  331.                     if (getflag(curfile, changed)) {
  332.                         putmsg("FILE SAVE FAILED")
  333.                         returnfalse
  334.                     }
  335.                 }
  336.                 putmsg("sending")
  337.                 freebuf(buf62)
  338.  
  339. ....  THE NEXT FEW LINES ARE FOR USE WITH BAUDBANDIT:
  340.                 insertrgn(buf62, efile, "\"address BAUD send '\\u\\as-", all)
  341.         getfilename(buf54, curfile)
  342.         insertrgn(buf62, efile, buf54, all)
  343.         insertrgn(buf62, efile, "'
  344. if show('P', 'Cap2Uedit-signal') then
  345.     address 'Cap2Uedit-signal' foo\"", all)
  346.  
  347. ....  USE THESE NEXT THREE COMMENTED OUT LINES FOR VLT:
  348.         ...     insertrgn(buf62, efile, "messagesend.vlt ", all)
  349.         ...     getfilename(buf54, curfile)
  350.         ...     insertrgn(buf62, efile, buf54, all)
  351.  
  352. ....            setfont("topaz", 8)             .. undo usage of IBM font
  353. ....            toggle(totiny)                  .. if you use such a thing
  354.  
  355.                 if (runkey(altctl-3)) {
  356.                     while (not rexxin(buf61,sFile,n97,n98,n99)
  357.                                 & eqnum(n99, -4)) delay(1)
  358.                     runkey(virtual-r)
  359.                 }
  360. >
  361.  
  362. Set Uedit's font (arg string is fontname, space, size; e.g. "topaz 8")
  363. <995:   movecursor(buf61, sfile)
  364.         movecursor(buf61, eword)
  365.         while (is(buf61, whitespace)) clearchar(buf61)
  366.         tonumber(n54, buf61)
  367.         equateloc(buf61, locA, atcursor)
  368.         equateloc(buf61, locB, efile)
  369.         clearrgn(buf61, loc)
  370.         movecursor(buf61, sfile)
  371.         tolower(buf61)
  372.         while (movecursor(buf61, echar))
  373.             tolower(buf61)
  374.         if (!setfont(buf61, n54))
  375.             putmsg("Could not set font")        ... SHOULD HANDLE ERROR BETTER
  376.         else {
  377.             toggle(totiny)                      .. reopen screen
  378.             toggle(totiny)
  379.         }
  380. >
  381.