home *** CD-ROM | disk | FTP | other *** search
/ Current Shareware 1994 January / SHAR194.ISO / modem / jbtutor1.zip / LESSON10.TXT < prev    next >
Text File  |  1993-09-19  |  3KB  |  81 lines

  1. IFEXist
  2. =======
  3.  
  4. {COMMO} macro language contains commands for testing various
  5. conditions.  One purpose for testing a condition is to branch to
  6. various segments of your script depending upon the result of the
  7. test, i.e., if test result is "X", then branch to segment "A" in
  8. script..if test result is "Y", then branch to segment "B" in script,
  9. etc..
  10.  
  11. One "condition" that is applicable to any mailrun script is a test to
  12. determine whether or not there are replies to send to the BBS during
  13. any given session.  Normally, a mailrun script would *always*
  14. download new mail.  But how do you handle those sessions where you
  15. don't have a .REP file to send?  What can we do to ensure .REPs are
  16. uploaded if there is one, and the upload process is skipped if there
  17. isn't a .REP?
  18.  
  19. Let's suppose our intended program flow for our mail send/rec portion
  20. of the script is:  Received mail door prompt?, upload replies if they
  21. exist, otherwise download new mail.  If replies exist, upload them
  22. first, then continue on with mail download.
  23.  
  24. Here's how that process might look on your flowchart:
  25.          ------------------------------------------------------------
  26.                       ┌───────────────────┐
  27.                       │Receive Mail Prompt│
  28.                       └─────────┬─────────┘
  29.                        ┌────────v─────────┐ Yes  ┌──────────┐
  30.                        │Do I Have Replies?├──────> Send "U" │
  31.                        └────────┬─────────┘      └────┬─────┘
  32.                                 │ No             ┌────v─────┐
  33.                                 │                │ Protocol │
  34.                                 │                │ Startup  │
  35.                                 │                │  String  │
  36.                                 │                └────┬─────┘
  37.                                 │                ┌────v──────┐
  38.                                 │                │ Exec Prot │
  39.                                 │                └────┬──────┘
  40.                                 │                ┌────v──────┐
  41.                                 │                │ Mail Prmpt│
  42.                                 │                └────┬──────┘
  43.                            ┌────v───┐                 │
  44.                            │Send "D"<─────────────────┘
  45.                            └────────┘
  46.          ------------------------------------------------------------
  47. IFEXist will be the command that will answer the "Do I have replies"
  48. question and will branch to the "Send U" or "Send D" segment
  49. depending upon the answer.   Here's how the coded segment might look:
  50. .
  51. .
  52.      {LOOK Mail Command?}
  53.      {IFEX %repdir%%bbsid.rep,send_u,send_d}
  54. {:SEND_U}
  55.      {SEND u|}
  56.      {LOOK ^xB01} (assuming ZModem is the protocol we use on this BBS)
  57.      {EXEC %zprog port %_por rz %qwkdir}
  58.      {LOOK Mail Command?}
  59. {:SEND_D}
  60.      {SEND d|}
  61. .
  62. .
  63. End of Lesson 10.  If you'd like something to ponder until next
  64. lesson, the following alternative coding to the segment above
  65. accomplishes the same thing, but contains a half-subtle method for
  66. eliminating unnecessary labels in your script.  Can you determine
  67. how/why?
  68. .
  69. .
  70.      {LOOK Mail Command?}
  71.      {IFEX %repdir%%bbsid.rep,,send_d}
  72.      {SEND u|}
  73.      {LOOK ^xB01} (assuming ZModem is the protocol we use on this BBS)
  74.      {EXEC %zprog port %_por rz %qwkdir}
  75.      {LOOK Mail Command?}
  76. {:SEND_D}
  77.      {SEND d|}
  78. .
  79. .
  80. Jim
  81.