home *** CD-ROM | disk | FTP | other *** search
/ Current Shareware 1994 January / SHAR194.ISO / modem / cs_mac08.zip / ACTION.MAC < prev    next >
Text File  |  1993-10-24  |  15KB  |  407 lines

  1.  
  2.  ┌────────────────────────────────┐
  3.  │  Chuck Seyboldt's COMMO Macro  │   CS-MAC08:ACTION.MAC
  4.  └────────────────────────────────┘
  5.  
  6.  {:|}    {send ~|}      {retu}
  7.  {:n}    {send ~n}      {retu}
  8.  {:n|}   {send ~n|}     {retu}
  9.  {:y|}   {send ~y|}     {retu}
  10.  {:loe}  {send ~^[^[}   {retu}
  11.  
  12.     ┌──────────────────────────────────┐
  13. ┌───┤  COMMO "ACTION processor" macro  ├───
  14.     └──────────────────────────────────┘
  15.   *
  16.   *  ACTION.MAC reads simple ASCII files and sends commands and
  17.   *  strings to the BBS based on the ACTION file.  Setup for PCBoards.
  18.   *
  19.   *  You may make an ACTION file manually with a text editor.
  20.   *  An ACTION file generator is included later as the :alf macro command.
  21.   *  Located in the COMMO home dir, the ACTION file has this sort of format:
  22.   *
  23. *┌───────────────────────────────  action.nl  ─┐
  24. *│ u                                           │ < "U" for upload
  25. *│ filename.ul                                 │ < Name the file to u/l
  26. *│ A line of file desription.  Up to 45 chars  │ < decription
  27. *│ in length.  Multiple line descriptions are  │
  28. *│ supported if your BBS host allows them.     │
  29. *│ --                                          │ < "--" to end ACTION item
  30. *│ d                                           │ < "D" for download
  31. *│ file1.dl                                    │ < batch downloads allowed
  32. *│ another.zip                                 │
  33. *│ filemore.lhz                                │
  34. *│ --                                          │ < "--" is important
  35. *│ u                                           │
  36. *│ another.zip                                 │
  37. *│ /Private to the sysop.  Thanks for the fish │
  38. *│ --                                          │ < Esp. at the very end.
  39. *└─────────────────────────────────────────────┘
  40.   *
  41.  {:action}
  42.          {sete-P0 esc}
  43.          {ifex %_hom%action.%abbr,,esc}
  44.          {rope %_hom%action.%abbr,act-end}              <- START here
  45.  {:reread}
  46.          {pops-c}
  47.          {setl 60,,10,|}
  48.          {read cmd}                          ;read line of ACTION file
  49.          {comp cmd,--}  {ifco reread}        ;branch to appropriate ACTION
  50.          {comp cmd,a}   {ifco asciup}
  51.          {comp cmd,j}   {ifco joincn}
  52.          {comp cmd,d}   {ifco dlfile}
  53.          {comp cmd,u}   {ifco ulfile}
  54.          {comp cmd,z}   {ifco zippy}
  55.          {comp cmd,g}   {ifco g_bye}         ;if no match, end ACTION
  56.  
  57.  {:act-end}                                  ;When at end of ACTION list
  58.          {exec-n echo ^j*-*-* %_dat %_tim >> %savedir\used-act.%abbr}
  59.          {exec-n type %_hom%action.%abbr  >> %savedir\used-act.%abbr}
  60.          {exec-n del  %_hom%action.%abbr}
  61.          {setv line}  {setv fname}
  62.          {setv cmd}   {setv bb}
  63.  {:esc}  {macl logon.mac,noact}                         <-  END here
  64.  
  65.  ┌──────────────────────────────┐
  66.  │  Download processor section  │
  67.  └──────────────────────────────┘
  68.  
  69.  {:dlfile}
  70.          {send %cmd%|}                  ;Setup is for Zmodem BATCH downloads
  71.          {golo skip,not avai}           ;If host doesn't allow d/l, skip it
  72.  {:next-d}{read fname}                  ;Read one complete line into %fname%
  73.          {inst fname,--} {ifco do-dl}
  74.          {ifex %dldir\%fname,next-d}    ;Don't try to d/l files that exist
  75.          {send %fname%~~ }              ;Send filename to BBS
  76.          {goto next-d}                  ;Repeat read til dl-list is all read
  77.  {:do-dl}{send |~~|~~|}                 ;Start download
  78.          {call dlfile-%prot}            ;call file download subroutine
  79.          {look %bbs_pmt}
  80.          {goto reread}                  ;end of "D" ACTION processor
  81.  
  82.  ┌────────────────────────────┐
  83.  │  Upload processor section  │
  84.  └────────────────────────────┘
  85.  
  86.  {:ulfile}
  87.          {read fname}                   ;Upload ACTION starts
  88.          {ifex %uldir\%fname,,skip}     ;Make sure file exists on your disk
  89.          {send u %fname% %prot|}        ;Tell host to get ready for u/l
  90.          {golo skip,Insufficient}       ; disk space for complete upload!
  91.          {golo skip,not avai}           ;If host doesn't allow u/l, or
  92.          {golo skip,y exists}           ;If host says file already exists,
  93.          {golo skip,plicates}           ;  skip this u/l action item.
  94.          {look ximum)}                  ;Host is ready for description.
  95.  {:desc} {read line}
  96.          {comp line,--}                 ;Check for end of u/l action
  97.          {ifco ul_ok}
  98.          {send ~%line%|}                ;Send description line
  99.          {goto desc}                    ;and look for more description
  100.  {:ul_ok}{send ~|}
  101.          {call ulfile-%prot}            ;call file transfer subroutine
  102.          {setl 60,,30,|}                ;Allow time for file validation
  103.          {push}
  104.          {golo |,remain online...}      ;for upload processing OK
  105.          {look %bbs_pmt}
  106.          {goto reread}                  ;end of "U" ACTION processor
  107.  
  108.  ┌────────────────────────────┐
  109.  │  Skip to next action item  │
  110.  └────────────────────────────┘
  111.  
  112.  {:skip} {read line}                    ;SKIP section jumps to next
  113.          {comp line,--}                 ;  action item by reading to
  114.          {ifco ,skip}                   ;  the next "--" string.
  115.          {send |}
  116.          {setl 50,,3,|}
  117.          {look %bbs_pmt}
  118.          {goto reread}                  ;alternate end of "U" processor
  119.  
  120.   *  ASCII uploads take a special form.  Here is an example message.
  121.   *  You may need to structure ASCII upload messages differently.
  122.   *
  123. *┌──────────────────────────────────  hijack ──┐
  124. *│ jack kilday                                 │ < Message Recipient
  125. *│ Thanks for the Fish                         │ < Message Subject
  126. *│ n                                           │ < Public/Private msg flag
  127. *│ u                                           │ < Use ASCII u/l, not editor
  128. *│ Hi Jack,                                    │
  129. *│                                             │
  130. *│     Just stopping in with a test of a COMMO │
  131. *│ ACTION macro processor.  I also wanted to   │
  132. *│ give you a big THANK YOU for all the fish.  │
  133. *│ They were delicious.                        │
  134. *│                                             │
  135. *│                                   Chuck·S   │
  136. *└─────────────────────────────────────────────┘
  137.   *
  138.  {:asciup}
  139.          {read fname}                   ;ASCII upload to PCBoard system
  140.          {ifex %dldir\%fname%,,reread}
  141.          {parm ,,,,2}                   ;Set character pacing
  142.          {send e|}                      ;Send "E" to start message entry
  143.          {asci %dldir\%fname%,}         ;Send the structured message
  144.          {parm ,,,,0}                   ;No character pacing
  145.          {send ~~|~~~sn|}               ;the PCBoard "save" command
  146.          {look %bbs_pmt}
  147.          {goto reread}                  ;end of "A" processor
  148.  
  149.  ┌───────────────────────────┐
  150.  │  Join conference section  │
  151.  └───────────────────────────┘
  152.  
  153.  {:joincn}
  154.          {read fname}                   ;Join PCBoard Conference
  155.          {send j %fname|}
  156.          {push}
  157.          {golo n|,)=yes?}               ;Skip mail scan
  158.          {golo |,invalid}               ;If you choose invalid conf
  159.          {golo n|,(H)elp}               ;If you chose invalid conf
  160.          {golo 0|,none?}                ;To conf 0 on invalid conf
  161.          {look %bbs_pmt}  {pops}
  162.          {goto reread}                  ;end of "J" processor
  163.  
  164.  
  165.  ┌──────────────────────┐
  166.  │  Zippy scan section  │
  167.  └──────────────────────┘
  168.  
  169.  {:zippy}
  170.          {read fname}
  171.          {clea}
  172.          {send z %fname a|}
  173.          {capt y,%savedir\zippy.%abbr}
  174.          {exec-n echo OPENED  ■  %_dat %_tim^j>> %_cap}
  175.          {push}
  176.          {golo |,more?}
  177.          {look %bbs_pmt}  {pops}
  178.          {clea}
  179.          {exec-n echo CLOSED  ■  %_dat %_tim^j■-■-■>> %_cap}
  180.          {capt n}
  181.          {goto reread}
  182.  
  183.  ┌───────────────────┐
  184.  │  Goodbye section  │
  185.  └───────────────────┘
  186.  
  187.  {:g_bye}{paus 1} {alarm 1} {parm ,,,,0} {disp ,,,^j^j}
  188.          {disp ,18,1E,▌ 'G' to LogOFF NOW ■ SpaceBar to stay ON  ▐}
  189.          {disp ,,,^m}
  190.          {setg 10,bye,n} {gets-h resp,1,bye};using Commo for timed branch
  191.          {comp resp,g} {ifco bye}           ;10 second delay, default=bye
  192.          {comp resp, } {ifco sta}
  193.  
  194.  {:sta}  {clea}                     ;"Stay" routine
  195.          {setv bbsid}
  196.          {setv capture}             ;clear flag to avoid closing .CAP
  197.          {goto reread}
  198.  
  199.  {:bye}  {send %bye%%rs}
  200.          {setl 10,,,}
  201.          {push}
  202.  
  203.          {golo loe,<esc>}           ;stifle host delays
  204.          {golo y|, log off }
  205.          {golo y|, logoff? }
  206.          {golo y|,Are you sure}     ;MajorBBS
  207.          {golo y|,Log Off?}         ;Virtual BBS
  208.          {golo n|, comment }
  209.          {golo |,?=help]?}          ;Charlie's Foxhole
  210.          {golo n,your choice -->}   ;EXEC-PC
  211.          {golo |,to continue:}      ;Babble
  212.  
  213.          {look NO CARRIER^m^j}      ;comes from modem
  214.          {pops}
  215.          {hang y}
  216.          {goto reread}
  217.  
  218.     ┌───────────────────────────────────┐
  219. └───┤  End Of "ACTION processor" macro  ├───────
  220.     └───────────────────────────────────┘
  221.  
  222.     ┌─────────────────────────────┐
  223. ┌───┤  "ACTION generator"  macro  ├───
  224.     └─────────────────────────────┘
  225.   *
  226.   *  This macro uses PKUNZIP to automatically insert the file
  227.   *  description from a DESC.SDI or a FILE_ID.DIZ that might be
  228.   *  found in a ZIP file.
  229.   *
  230.   *  This macro isn't commented.  It is pretty easy to follow.
  231.  
  232.  {:alf}  {sete-p0 no_del}
  233.          {inpu abbr,Make ^(ACTION^) file:  What BBS?}   <- START Here
  234.          {comp abbr}    {ifco opena}
  235.          {subs abbr,1,2,%abbr}
  236.  {:opena}{wope-a %_hom%action.%abbr}
  237.  
  238.  {:icmnd}{setv cmd} {setv fname} {setv line}
  239.          {sete-p0 no_del}
  240.          {setv _menu1, D   Download}
  241.          {setv _menu2, U   Upload}
  242.          {setv _menu3, Z   Zippy scan}
  243.          {setv _menu4, A   Ascii Upload}
  244.          {setv _menu5, J   Join Conf}
  245.          {setv _menu6, G   Goodbye}
  246.          {setv _menu8, X   eXit & Edit}
  247.          {setv _menter,e_cmnd}
  248.          {setv _mlabel,makeau,,,makedl,,,makegb,,,makejn,,,,,,,,,,,makeul,,,e_cmnd,,makezi}
  249.          {menu 12,18, Action  Menu }
  250.          {goto e_cmnd}
  251.  
  252.          {inpu cmd,^(U^)pload, ^(D^)ownload, ^(A^)scii Upload, ^(J^)oin Conf?}
  253.          {comp cmd,u}   {ifco makeul}
  254.          {comp cmd,d}   {ifco makedl}
  255.          {comp cmd,a}   {ifco makeau}
  256.          {comp cmd,j}   {ifco makejn}
  257.          {comp cmd,g}   {ifco makegb}
  258.          {comp cmd,z}   {ifco makezi}
  259.          {comp cmd}     {ifco ,icmnd}
  260.  {:e_cmnd}
  261.          {wclo}         {edit %_hom%action.%abbr}
  262.          {ifex %_hom%action.%abbr,,no_del}
  263.          {rope %_hom%action.%abbr}
  264.          {read line}    {rclo}                  ;check for empty
  265.          {comp line}    {ifco ,no_del}          ;ACTION file
  266.          {exec-n del %_hom%action.%abbr}        ;delete if empty
  267.  {:no_del}
  268.          {setv cmd}     {setv fname} {setv line}
  269.          {comp mt}      {ifco ,menu}
  270.          {macl %_mac,auto}                              <- END Here
  271.  {:menu} {macl cs-mac.mac,clect}                        <-  or here
  272.  
  273.  {:makegb}
  274.          {writ g}
  275.          {writ --}
  276.          {goto e_cmnd}
  277.  
  278.  {:makejn}
  279.          {inpu fname,Name or Number of Conference to Join}
  280.          {comp fname}   {ifco icmnd}
  281.          {writ j}
  282.          {writ %fname}
  283.          {writ --}      {goto icmnd}
  284.  
  285.  {:makeau}
  286.          {inpu fname,Name the ASCII Upload}
  287.          {comp fname}   {ifco icmnd}
  288.          {ifex %dldir\%fname,,makeau}
  289.          {writ a}
  290.          {writ %fname}
  291.          {writ --}      {goto icmnd}
  292.  
  293.  {:makedl}
  294.          {setv fname}   {setv count,1}
  295.          {inpu fname,Name a File that you want to DownLoad}
  296.          {comp fname}   {ifco icmnd}
  297.          {writ d}
  298.  {:dlmore}
  299.          {writ %fname}
  300.          {incr count}   {setv fname}
  301.          {inpu fname,File #%count% to Download?}
  302.          {comp fname}   {ifco ,dlmore}
  303.          {writ --}      {goto icmnd}
  304.  
  305.  {:makeul}
  306.          {inpu fname,Name the file to upload}
  307.          {comp fname}   {ifco icmnd}
  308.          {ifex %dldir\%fname,descul,makeul}
  309.  {:descul}
  310.          {exec-d %pk_un -v %dldir\%fname desc.sdi file_id.diz}
  311.          {ifer 1,,diz_dsc}
  312.          {setv count,1}
  313.          {setv line}
  314.          {inpu line,One line description of %fname% Required}
  315.          {comp line}    {ifco icmnd}
  316.          {writ u}       {write %fname}
  317.          {writ %line}   {incr count}
  318.  {:mdesc}{setv line}    {inpu line,Line %count% of %fname% description}
  319.          {comp line}    {ifco endul}
  320.          {writ %line}   {incr count}
  321.          {goto mdesc}
  322.  {:endul}{writ --}      {goto icmnd}
  323.  
  324.  {:diz_dsc}
  325.          {writ u}       {write %fname}
  326.          {setv file,file_id.diz}
  327.  {:add_dsc}
  328.          {exec-d %pk_un -v %uldir\%fname %file}
  329.          {ifer 1,chk_sdi}
  330.          {exec-n %pk_un -o %uldir\%fname %ramdr\ %file}
  331.          {rope %ramdr\%file,endul}
  332.  {:diz_lp}
  333.          {read line}
  334.          {writ %line}
  335.          {goto diz_lp}
  336.  {:chk_sdi}
  337.          {setv file,desc.sdi}
  338.          {goto add_dsc}
  339.  
  340.  {:makezi}
  341.          {inpu fname,Zippy Scan Text}
  342.          {comp fname}   {ifco icmnd}
  343.          {writ z}
  344.          {writ %fname}
  345.          {writ --}      {goto icmnd}
  346.  
  347.  
  348.     ┌───────────────────────────────────┐
  349. └───┤  End Of "ACTION generator" macro  ├───────
  350.     └───────────────────────────────────┘
  351.  
  352.  ┌──────────────────────────────────────┐
  353.  │  File Transfer protocol subroutines  │
  354.  └──────────────────────────────────────┘
  355.   *
  356.   *  This arrangement provides a method to easily expand the file
  357.   *  transfer protocols that one might use.
  358.  
  359.  ┌──────────┐
  360.  │  Zmodem  │
  361.  └──────────┘
  362.  {:ulfile-z}
  363.  {:ulfile-}                             ;default protocol is "Z"
  364.          {look ^xB01}                   ;Zmodem .REP Upload
  365.          {exec-n %z_prog port %_por ha bo sz -m %uldir\%fname}
  366.          {retu}
  367.  
  368.  {:dlfile-z}
  369.  {:dlfile-}                             ;default protocol is "Z"
  370.          {push}
  371.          {golo reread,%bbs_pmt}         ;if no filenames matched
  372.          {golo n|,ed? [}                ;Wildcat logoff after transfer
  373.          {golo z|,] ? [}                ;Wildcat protocol select
  374.          {look ^xB00}
  375.          {pops}
  376.          {exec-n %z_prog port %_por ha bo rz -mr %dldir}
  377.          (exec-n %z_prog port %_por ha bo rz -mr %dldir>NUL)
  378.          {golo reread,] ? [}            ;At Wildcat File Menu
  379.          {retu}
  380.  
  381.  ┌──────────┐
  382.  │  Ymodem  │
  383.  └──────────┘
  384.  {:ulfile-y}                            ;Ymodem File Upload
  385.          {paus 10}
  386.          {symo-k %uldir\%fname}
  387.          {retu}
  388.  
  389.  {:dlfile-y}                            ;Ymodem File Download
  390.          {paus 10}
  391.          {rymo-y %dldir}                ;overwrite exiting files
  392.          {retu}
  393.  
  394.  ┌──────────┐
  395.  │  Xmodem  │
  396.  └──────────┘
  397.  {:ulfile-x}                            ;Xmodem File Upload
  398.          {paus 10}
  399.          {sxmo-y %uldir\%fname}
  400.          {retu}
  401.  
  402.  {:dlfile-x}                            ;Xmodem File Download
  403.          {paus 10}
  404.          {send g}
  405.          {rxmo-y %dldir\%fname}
  406.          {retu}
  407.