home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / comm / zcm_scrp.zip / GEMSGUP.T < prev    next >
Text File  |  1989-11-21  |  8KB  |  226 lines

  1. :: GEnie IBM PC RoundTable message upload script for YAM TurboDial 2.18+
  2. ::
  3. :: Author:  Rahul Dhesi
  4. :: Date:    1986/10/25
  5. :: Version: 2.0 CAF Rev 10-17-88
  6. ::
  7. :: Ideas were borrowed from Paul Homchick's file uploading script.  This 
  8. :: script may be freely copied and modified by all.  I accept no liability 
  9. :: should you go insane trying to figure out YAM's script commands.
  10. ::
  11. ::
  12. ::                               MESSAGE FORMAT
  13. ::
  14. :: Each message to be uploaded is kept in a separate file.  Each message file
  15. :: must begin with the prefix "msg" and must not have any extension.  Good
  16. :: names to use are "msg1", "msg2", ..., "msg10", "msg11", and so on.  Each 
  17. :: message file has one of the the following formats:
  18. ::  Old format:
  19. ::
  20. ::      line 1:  category number
  21. ::      line 2:  topic number
  22. ::      rest:    message text
  23. ::
  24. ::  New format:
  25. ::    line 1: Category 5,  Topic 36
  26. ::      rest:    message text
  27. ::
  28. :: See the sample message files provided.
  29. ::
  30. :: This script is invoked after you are already logged in to GEnie and
  31. :: are at any GEnie menu.  It is invoked from your phones.t file and
  32. :: a sample phones.t file is supplied to show how this is done.
  33. :: This script simply returns to its caller.  The portion of phones.t
  34. :: that invokes this script is responsible for logging you out.
  35. ::
  36. ::                         ADJUSTABLE PARAMETERS
  37. ::
  38. :: This script assumes that your system-wide prompt character is ">".  If
  39. :: your prompt character is different, e.g. "?", see items I and II. If your 
  40. :: GENie break character is not control C, make a change in item III.  
  41.  
  42. ::I.  SET PROMPT CHARACTER.  Here we set the system-wide prompt character 
  43. :: to ">".  If your prompt character is different, change the following 
  44. :: line, e.g.:  set pr "?"   (set in phone directory)
  45. :    set pr "\006"
  46. :       set pr "?"      : not currently in use
  47.  
  48. ::II.  SET ASCII CODE FOR PROMPT CHARACTER.  Here we set the decimal ASCII 
  49. :: code for your system-wide prompt character.  For example, if your prompt 
  50. :: character is "?", the next line will become:  set code "63"
  51.     set code "62"
  52. :       set code "63"   : not currently in use
  53.  
  54. ::III. SET BREAK CHARACTER.  Now, make sure that our break character is 
  55. :: known to the script.  If it is control C, the value is "\003". Otherwise, 
  56. :: change the following line.
  57. :    set intr "\003"   (set in phone directory)
  58.  
  59. ::IV.  Set page number in s7
  60. :    set s7 "615"
  61.  
  62.  
  63. ::*******************************************************************
  64. ::The script itself starts here.  Some patterns are initialized and we
  65. ::try to reach the RoundTable Bulletin Board first.
  66.     echof ""
  67.         echoc "MSGUP:  Beginning upload of file %1"
  68.         set blankfill "  "              : convert null lines to blanks
  69.         pattern
  70.         pat 1v "P %s7%pr"        : e.g. "P 615>"
  71.     pat 3v "1 %pr"            : e.g. "1 >"
  72.     pat 7v "<H>elp"
  73.  
  74. ::Send a carriage return and see what GEnie does
  75.         put "\r"                : hit return
  76.         wait -f20                  : wait for any pattern
  77.     if 7 put "m%s7:1\r" wait -f20
  78.     while 7&&L<2 put "c\r" wait -f20
  79.         while !1&&!3&&L<2 put "c\r" wait -f20
  80.         while !3&&L<3 put "m%s7:1\r" wait -f20  : try to go to RT BBS
  81.  
  82. ::If nothing happened, send our break character to wake GEnie & try again
  83.     if !3 put "%intr" wait -f20        : send break
  84.     if !1&&!3&&!5 goto failed        : no pattern still? give up
  85.     if 3 goto foundrt            : if found "1 >", go on...
  86.     while !3&&L<3 put "m%s7;1\r" wait -f20    : else try to go to RT BBS
  87.     if !3 goto failed            : not reached BBS?  fail
  88.  
  89. ::If we reach the bulletin board and see the prompt for category 1
  90. ::(e.g. "1 >"), we find the next message and select category and topic.
  91. foundrt:
  92.         open -!tg %1            : open message file
  93.                     : !t = no throttle (full speed)
  94.                     : !g = don't send file yet
  95.     set s0 ""            : get 1st two lines (cat & topic)
  96.     while "t&&!%s0"  grab s0
  97.     if !ps0,Category goto oldf
  98.     ss s0 "([0-9]+)(,[^0-9]*)([0-9]+)"
  99.     sets s0 %z1
  100.     sets s1 %z3
  101.     : set
  102.     : abort
  103.     goto newf
  104. oldf:    grab s1                : get 1st two lines (cat & topic)
  105.         if !t goto nullmsg
  106. newf:    if "as0<1" goto nonumber    : category must be nonzero
  107.     if "as1<1" goto nonumber    : topic must nonzero
  108.     pat 2 "ot \256vailable"         : \256 is wildcard for pattern match
  109.     pat 3i "%s0 %pr"             : e.g. pat 3 "5 >"
  110.  
  111. ::Select the desired category
  112.         put "set %s0\r"            : e.g. "set 5<cr>", 5 being category
  113.         wait -f30            : wait for cat to be chosen
  114.     if 2 goto nosuchcat
  115.         if !3 goto nocat               : give up if not chosen cat
  116.  
  117. ::Select the desired topic
  118.     pattern
  119.     pat 2 "is closed"
  120.     pat 3 "ot \256vailable"
  121.     pat 4 "annot \256eply"
  122.     pat 5 "# of topic"
  123.     pat 6l "nter \256emo \256ext"
  124.     put "reply %s1\r"        : e.g. "reply 22<cr>", 22 being topic
  125.         wait -f30
  126.     while n&&L<2 put "reply %s1\r" wait -f20 : Give GEnie two chances
  127.  
  128. ::If GEnie says, "Enter # of topic..." something must have gone wrong.
  129. :: We escape from there with a break character and give up on this one.
  130.     if 5 put "%intr" goto nosuchtop : escape from prompt & give up
  131.  
  132. ::Closed topic, or no such topic, or no "Enter memo text" prompt
  133.     if 2||4 goto closed        : topic is closed, can't reply to it
  134.     if 3 goto nosuchtop        : No such topic
  135.         if !6 goto noreply             : no reply prompt
  136.     pat 7 ">"
  137.     wait
  138.  
  139. ::We reach here if we saw a string asking us to reply to the topic
  140.  
  141. ::Following lines from Paul Homchick's file upload script.  No idea what they
  142. :: do but we'll let them stay there since they don't cause any harm.
  143.     if !dP ena -p            : Ask Paul
  144.     if dP ena -r            : Ask Paul
  145.  
  146.     pp4
  147.     put "*u\r"            : Shift gears, no echo upload
  148.     pat 6l INPUT
  149.     wait; pat; sleep 10
  150. ::Upload the message, waiting for the prompt character after each line has
  151. ::been sent
  152.         t -Hgx                : send file, continue script when done
  153.     ena -ht!p            : enable throttle, disable wait for ">"
  154.     : pp250                : disable prompt character
  155.     pattern
  156.     pat 1 "entered"
  157.     put "%intr"
  158.     pat 6 ">"
  159.     wait
  160.         put "*s\r"                      : send "*s<cr>"
  161.     wait -f20
  162.     if !1 put "*s\r" wait -f20
  163.     if !1 goto doubtful
  164.     : put "set 1\r"
  165.     goto goodret
  166.  
  167. goodret:
  168.         obey "!mv %1 Z%1.tmp" : ren original to Z*.tmp
  169.     echof ""
  170.         echoc "MSGUP:  Message %1 transmitted."    : record successful transmission
  171.         return
  172. failed:
  173.     echof ""
  174.     echoc "MSGUP:  Could not find RoundTable BBS."
  175.     goto badret
  176. closed:
  177.     echof ""
  178.     echoc "MSGUP:  Category %s0 topic %s1 is closed.  Cannot reply."
  179.         goto badret
  180. nosuchtop:
  181.     echof ""
  182.     echoc "MSGUP:  Category %s0 has no topic %s1.  Cannot reply."
  183.         goto badret
  184. nosuchcat:
  185.     echof ""
  186.     echoc "MSGUP:  Category %s0 is not available.  Cannot reply."
  187.     goto badret
  188. nullmsg:
  189.     echof ""
  190.     echoc "MSGUP:  Message null, not sent."
  191.     goto badret
  192. nocat:
  193.     echof ""
  194.     echoc "MSGUP:  Could not set category %s0."
  195.     goto badret
  196. noreply:
  197.     echof ""
  198.     echoc "MSGUP:  Did not receive Reply prompt."
  199.         goto badret
  200. nonumber:
  201.     echof ""
  202.     echoc "MSGUP:  Category or topic not nonzero."
  203.     goto badret
  204.  
  205. ::Reach here if something went wrong.  Rename file to Y*.tmp.
  206. :: Send a "set 1" for good measure and return.
  207. badret:
  208.     obey "!mv %1 Y%1.tmp"
  209.     goto restore
  210.  
  211. ::Reach here if we thought we sent the message OK but GEnie didn't seem
  212. :: notice.  Rename to W*.tmp
  213. doubtful:
  214.     echof ""
  215.     echoc "MSGUP:  Message may or may not have been entered"
  216.     obey "!mv %1 W%1.tmp"
  217.     goto restore
  218.  
  219. restore:
  220.     pattern
  221.     pattern 1 "%pr"
  222.         while !1&&L<2 put "\r" wait -f20
  223.     pattern 1 "1 %pr"
  224.     closetx
  225.         return
  226.