home *** CD-ROM | disk | FTP | other *** search
/ HomeWare 14 / HOMEWARE14.bin / comms / icom0425.arj / SCRDEMO.SCR < prev    next >
Text File  |  1994-04-25  |  27KB  |  636 lines

  1. ;----------------------------------------------------------------------------
  2. ; SCRDEMO.SCR  Intellicomm v2 script language demonstration.
  3. ;----------------------------------------------------------------------------
  4.  
  5.  gosub Initialize
  6.  gosub MainMenu
  7.  gosub FindScriptDOC
  8.  goto  ExitDemo
  9.  
  10. ;----------------------------------------------------------------------------
  11. Initialize:
  12. ;----------------------------------------------------------------------------
  13.  
  14.  variable lstat_on $STAT_ON         ;save original state of status line
  15.  variable lscrn_color $SCRN_COLOR   ;save original screen color
  16.  variable i                         ;for general purpose
  17.  variable s
  18.  variable last_selection 1          ;for main menu, holds the last selection
  19.  variable SCRTUTOR "SCRTUTOR.DOC"   ;the script tutorial document
  20.  variable fspec "\*.*"
  21.  variable size
  22.  variable key
  23.  variable tag
  24.  variable name
  25.  variable date
  26.  variable desc
  27.  variable catalog "NEWFILES"
  28.  
  29.  variable m1 "~Welcome!"            ;main menu options (for use below)
  30.  variable m2 "~Interactive Commands"
  31.  variable m3 "~DOS/File Commands"
  32.  variable m4 "~Catalog Commands"
  33.  variable m5 "R~un another Script"
  34.  variable m6 "D~OS File Manager"
  35.  variable m7 "~Jump to DOS Shell"
  36.  variable m8 "e~Xit"
  37.  
  38.  vpush                           ;video push (save the screen)
  39.  assign $STAT_ON 0               ;shut off the status line
  40.  assign $SCRN_COLOR $NORM_COLOR  ;use the regular Icom menu color on-screen
  41.  cls
  42.  return
  43.  
  44. ;----------------------------------------------------------------------------
  45. CleanUp:
  46. ;----------------------------------------------------------------------------
  47.  
  48.  vpop                            ;restore the screen
  49.  assign $STAT_ON lstat_on        ;restore the status line (if it was on)
  50.  return
  51.  
  52. ;----------------------------------------------------------------------------
  53. PressKey:
  54. ;----------------------------------------------------------------------------
  55.  
  56.  pause "^M^J^BPlease press a key...^B "
  57.  cls
  58.  return
  59.  
  60. ;---------------------------------------------------------------------------
  61. MainMenu:
  62. ;---------------------------------------------------------------------------
  63.  
  64.  strset s "░" 0 $SCRN_WIDTH  ;fill 's' with ░, to the screen width
  65.  
  66.   ;PRINTRAW is much faster than PRINT
  67.  
  68.  assign i 1
  69.  while i <= $SCRN_HEIGHT
  70.   printraw 1 i $NORM_COLOR s
  71.   inc i
  72.  endwhile
  73.  
  74.  eraseline 1 $STAT_COLOR
  75.  printraw -1 1 $STAT_COLOR "Intellicomm v2.0 Script Demonstration"
  76.  
  77.  menudefine m1 m2 "-" m3 m4 "-" m5 m6 m7 m8
  78.  
  79.   ;the MENUHLP command attaches help to a menu item so that when the
  80.   ; user hilights the item, the help is displayed.
  81.  
  82.  menuhlp 1 "Welcome to the Intellicomm v2 Script Demonstration!"
  83.  menuhlp 2 "Preview the script user-interactive features"
  84.  menuhlp 3 "Preview the DOS and file-oriented script features"
  85.  menuhlp 4 "Preview the script File Tagger catalog handling features"
  86.  menuhlp 5 "Demonstrates interactive script running from within a script"
  87.  menuhlp 6 "Demonstrates interactive file handling from within a script"
  88.  menuhlp 7 "Demonstrates use of the DOS 'shell' feature from within a script"
  89.  menuhlp 8 "Exit the script demonstration"
  90.  
  91.  menuboxv "SCRDemo Main Menu" "Select a Demonstration" last_selection
  92.  
  93.   ;the item selected is stored in the System Variable $MENUSELECTION
  94.   ; if 1, menu item 1 (Welcome!) was selected, and so forth.  If 0
  95.   ; then the user pressed ESC or clicked the mouse outside of the
  96.   ; menu.
  97.  
  98.  assign last_selection $MENUSELECTION   ;save for next menu display
  99.  
  100.  switch $MENUSELECTION
  101.   case 1
  102.    gosub Welcome
  103.   endcase
  104.   case 2
  105.    gosub InteractiveDemo
  106.   endcase
  107.   case 3
  108.    gosub DOSDemo
  109.   endcase
  110.   case 4
  111.    gosub CatDemo
  112.   endcase
  113.   case 5
  114.    gosub RunScript
  115.   endcase
  116.   case 6
  117.    FileMan                    ;call the File Manager (default directory)
  118.   endcase
  119.   case 7 
  120.    Dos                        ;DOS shell (when no command given)
  121.   endcase
  122.   default                     ;ESC pressed (0) or eXit (item 11) selected
  123.    return
  124.  endswitch
  125.  
  126.  goto MainMenu                ;re-display the menu
  127.  
  128. ;----------------------------------------------------------------------------
  129. Welcome:
  130. ;----------------------------------------------------------------------------
  131. ;You'll see ^B and ^M^J here and there in the text below.  ^B (Ctrl-B)
  132. ; toggles 'bold' text on/off, while ^M^J (Ctrl-M, Ctrl-J) prints a
  133. ; Carriage Return, Line Feed to advance the cursor down a line leaving a
  134. ; BLANK line.
  135.  
  136.  cls
  137.  print "^M^JWelcome to the exciting world of ^BIntellicomm scripts^B!^M^J"
  138.  
  139.  print "This demonstration will show you some (but not all) of the things you can do"
  140.  print "with scripts.  Icom's script language is very rich and powerful and it"
  141.  print "includes many features that you won't find anywhere else, in ^BANY^B script"
  142.  print "language!  Discover the language piece by piece, as time permits: You'll soon"
  143.  print "find yourself able to do some truly incredible things that will surely give"
  144.  print "you great satisfaction and will increase your enjoyment of, and control over,"
  145.  print "Intellicomm."
  146.  
  147.  strset s "─" 0 78  ;put 78 "─" characters in variable 's' (a line)
  148.  print s            ;print the line
  149.  
  150.  print "The main purpose of scripts is to automate tasks that Intellicomm doesn't"
  151.  print "currently support with its automated jobs.  You can dial BBS's and automate"
  152.  print "just about anything you can imagine, or can ^bintegrate^B your scripts with"
  153.  print "Icom's automated jobs and BIFs... so that Icom does the dialing, logon and"
  154.  print "logoff, and you just handle the tasks you want done in between.  All of this"
  155.  print "and much more is outlined in the first ten or so pages of ^B" SCRTUTOR "^B and"
  156.  print "is absolutely and positively worth a read!^M^J"
  157.  
  158.  print "[^BNOTE:^B  To abort this demonstration (or any script) at any time, press"
  159.  print "the ^B[Alt-Q]^B key, then select ^"^BAbort Script Only^B^" from the Alt-Q"
  160.  print "menu.]"
  161.  
  162.  gosub PressKey      ;subroutine PressKey is defined below.
  163.  
  164.  print "No matter how inexperienced you are with programming (script or otherwise)"
  165.  print "there is simply no way you can FAIL to learn at least ^Bsome^B of the useful"
  166.  print "script language features, if you spend half-an-hour with ^B" SCRTUTOR "^B."
  167.  
  168.  print "If you can read and understand this text on-screen, you won't have to stretch"
  169.  print "very far to understand many of the script commands.  There ^Bare^B some script"
  170.  print "features that are designed for more advanced users, but for the most part"
  171.  print "anyone can learn script basics.  And the basics are very powerful and useful"
  172.  print "indeed!  You're simply cheating yourself out of much enjoyment and satisfaction"
  173.  print "if you choose to avoid scripts.^M^J"
  174.  
  175.  print "None of the script 'online' or communications functions are demonstrated"
  176.  print "here, simply because it's nearly impossible to write a script to dial a"
  177.  print "BBS or to logon/perform some tasks without prior knowledge of the BBS."
  178.  print "^BYou^B will be able to accomplish a great deal in that area, once you get"
  179.  print "a specific BBS and task in mind and once you give ^B" SCRTUTOR "^B the once-"
  180.  print "over.  In this demonstration we'll be showing you only some of the"
  181.  print "interesting visual and input functions available.^M^J"
  182.  
  183.  print "You're already looking at some basic video output, but you can certainly"
  184.  print "perform much more interesting video output with scripts."
  185.  gosub PressKey
  186.  
  187.  WNDOPEN "Window 1"              ;no coordinates opens a full-screen window.
  188.  WNDOPEN "Window 2" 10 5 70 20   ;x1,y1, x2,y2 screen coordinates
  189.  WNDOPEN "Window 3" 1 1 80 5
  190.  WNDOPEN "Window 4" 1 6 80 10
  191.  WNDOPEN "Window 5" 1 11 80 15
  192.  WNDOPEN "Window 6" 1 16 80 20
  193.  WNDOPEN "Window 7" 1 21 80 25
  194.  WNDOPEN "WNDOPEN"  3 3 78 23
  195.  
  196.  print "The ^BWNDOPEN^B command opens a box with a border and allows you to print"
  197.  print "information without worrying about where the box limits are.  ^BWNDOPEN^B"
  198.  print "automatically sets the current WINDOW to within the box borders so"
  199.  print "when you use ^BCLS^B to clear the screen, or ^BPRINT^B/^BPRINTNC^B (^BNC^B=No CR),"
  200.  print "only the space within the box is affected.  ^BWNDOPEN^B also does all of"
  201.  print "the following:^M^J  ^B^B"
  202.  print "  ■ Saves the current screen information (and colors) under the box"
  203.  print "    for later restoration with ^BWNDCLOSE^B.
  204.  print "  ■ Saves the current ^B$SCRN_COLOR^B (screen color) value and current X"
  205.  print "    and Y coordinates of the cursor, again restored when ^BWNDCLOSE^B is"
  206.  print "    executed."
  207.  print "  ■ Displays a box with optional title, using the regular Icom colors."
  208.  print "  ■ Automatically executes a ^BWINDOW^B command to set the logical screen"
  209.  print "    within the box borders.  ^BNOTE:^B the 'logical' screen is also"
  210.  print "    observed when displaying data from the COM port, so you can also"
  211.  print "    cause BBS output to be displayed within a window!"
  212.  gosub PressKey
  213.  
  214.  print "Note how the ^BCLS^B (clear screen) command affects only the current"
  215.  print "window.  ^BCLS^B was used to clear the window after you pressed a key."
  216.  print "To close windows opened with ^BWNDOPEN^B and restore the previous screen"
  217.  print "color and cursor coordinates, simply call ^BWNDCLOSE^B."
  218.  gosub Presskey
  219.  
  220.  WNDCLOSE
  221.  print "Now we have returned to the previous window."
  222.  gosub PressKey
  223.  WNDCLOSE
  224.  print "Another call to ^BWNDCLOSE^B closes this window."
  225.  gosub PressKey
  226.  WNDCLOSE
  227.  print "Another call to ^BWNDCLOSE^B closes this window."
  228.  gosub PressKey
  229.  WNDCLOSE
  230.  print "And another."
  231.  gosub PressKey
  232.  WNDCLOSE
  233.  print "And another."
  234.  gosub PressKey
  235.  WNDCLOSE
  236.  print "And another."
  237.  gosub PressKey
  238.  WNDCLOSE
  239.  print "And now we're back at the first window we opened.  The final ^BWNDCLOSE"
  240.  print "will return us to the Main Menu."
  241.  gosub PressKey
  242.  
  243.  WNDCLOSE
  244.  return
  245.  
  246. ;----------------------------------------------------------------------------
  247. InteractiveDemo:
  248. ;----------------------------------------------------------------------------
  249.  
  250.  wndopen "Interactive Commands"
  251.  
  252.  print "This section demonstrates some of the 'interactive' commands available."
  253.  print "Using these commands your script can interact with the user just as this"
  254.  print "demonstration (which is run entirely BY a script) is interacting with you.^M^J"
  255.  
  256.  print "With the ^BINKEY^B and ^BINKEYW^B (^BW^B for Wait) commands you can get a key"
  257.  print "from the keyboard and check it to see which key was pressed.^M^J"
  258.  
  259.  printnc "Please press ^BF2^B to continue: "
  260.  
  261.  while 1                      ;WHILE 1 loops forever (or until a BREAK)
  262.   inkeyw i                    ;wait for a keypress, store in 'i'
  263.   if i = 15360                ;if i equals F2 (15360 is the keycode)
  264.    print "^M^JThank you for pressing the ^BF2^B key."
  265.    delay 25                   ;pause for 2.5 seconds (25 tenths)
  266.    break                      ;BREAK exits the while loop
  267.   endif
  268.   beep
  269.   gotoxy 1 $SCRN_Y           ;column 1, same line (over the previous prompt)
  270.   printnc "That wasn't the ^BF2^B key.  Please try again: "
  271.  endwhile
  272.  
  273.  cls
  274.  print "You can also get several characters of input from the keyboard using"
  275.  print "^BBOXGETS^B, which displays a box with optional help line, or with"
  276.  print "^BGETS^B which just displays the input field without a box.  You can"
  277.  print "also offer a default response which the user can edit using the usual"
  278.  print "cursor editing keys (^BIns^B, ^BDel^B, ^BLeft^B, ^BRight^B, ^BHome^B, ^BEnd^B, etc)."
  279.  print "If a 'non-editing' key is pressed, the default is cleared from the input"
  280.  print "field."
  281.  
  282.  assign s "This is the default response"
  283.  boxgets s 40 "Input Box Courtesy of BOXGETS" "Enter something in the input field, or press [Esc]"
  284.  print
  285.  
  286.  switch $ERRORLEVEL   ;BOXGETS sets $ERRORLEVEL to 0 if something entered
  287.   case 0
  288.     ;note here how multiple items are printed with a single PRINT command
  289.     ; ...first we print "You entered '" and turn bold on, then we print
  290.     ; variable s, then turn bold off and print the closing ' and a period.
  291.    print "You entered '^B" s "^B'."
  292.   endcase
  293.   case 1
  294.    print "You entered nothing in the input field."
  295.   endcase
  296.   case 2
  297.    print "You pressed the ^BEsc^B key!"
  298.   endcase
  299.  endswitch
  300.  
  301.  print "^M^JYou can also get input via a menu using the ^BMENUBAR^B command:"
  302.  printnc "Are you gaining interest in scripts?  "
  303.  
  304.  menudefine "~Yes" "~No"  ;define a Yes  No menu (~ = hotkeys)
  305.  menubar                  ;display the menu and get the input
  306.  
  307.   ;MENUBAR (and MENUBOXH, MENUBOXV) set $MENUSELECTION to either the menu
  308.   ; item selected (1 for the 1st item: Yes, 2 for the 2nd item: No), or
  309.   ; set it to 0 if the user pressed the ESC key.
  310.  
  311.  if $MENUSELECTION <> 1               ;not equal to 1 (Yes)?
  312.   print "I'm sorry to hear that."     ;the user selected "No" or [Esc]
  313.   printnc "Would you like to quit?  "
  314.   menubar                             ;<-- No need to MENUDEFINE for same one
  315.   if $MENUSELECTION = 1 goto ExitDemo ;user wants to exit... the nerve. <grin>
  316.  endif
  317.  
  318.  print "^BGood!^B  I'm glad to hear it."
  319.  print "^M^JYou can also attach help to each menu item similar to Icom's bar menus:^M^J"
  320.  
  321.  menudefine "Option ~1" "Option ~2" "Option ~3" "e~Xit"
  322.  menuhlp 1 "Press the [Left] and [Right] arrow keys to see this menu work"
  323.  menuhlp 2 "This would be a description of Option 2"
  324.  menuhlp 3 "And this would be a description of Option 3"
  325.  menuhlp 4 "Exit this menu"
  326.  menubar
  327.  
  328.  cls
  329.  print "You can get input via two types of 'box' menus using the ^BMENUBOXH^B"
  330.  print "(horizontal menu in a box) and ^BMENUBOXV^B (vertical menu in a box):"
  331.  
  332.   ;we're using different menu options here, so MENUDEFINE is called again
  333.   ; to redefine the menu.  If we were going to use the "Yes/No" menu we
  334.   ; defined earlier though, we could skip the MENUDEFINE.  It need only
  335.   ; be called to define a NEW menu (the Yes/No menu is replaced with this
  336.   ; MENUDEFINE
  337.  
  338.  menudefine "Item ~1" "Item ~2" "Item ~3"
  339.  menuboxh "Box Menu courtesy of MENUBOXH" "Optional help line"
  340.  
  341.   ;you can test MENUSELECTION in any order... it isn't necessary to check
  342.   ; 0 first... you could check 3, then 1, then 0, then 2 if you wanted
  343.  
  344.  if $MENUSELECTION = 0 print "You pressed the ^BEsc^B key!"
  345.  if $MENUSELECTION = 1 print "You selected ^BItem 1^B."
  346.  if $MENUSELECTION = 2 print "You selected ^BItem 2^B."
  347.  if $MENUSELECTION = 3 print "You selected ^BItem 3^B."
  348.  
  349.  cls
  350.  print "You can also move the optional help line to the same line as the menu:"
  351.  
  352.   ;with a TAB (^I) as the first character of the help, MENUBOXH
  353.   ; displays the help on the same menu line
  354.  
  355.  menuboxh "Also courtesy of MENUBOXH" "^IEnter selection:"
  356.  
  357.  cls
  358.  print "You can also 'hide' and disable menu options at will.  Here's a vertical"
  359.  print "box menu with some menu items hidden.  If you select '^BEnable more Options^B'"
  360.  print "more menu selections will be displayed."
  361.  
  362.  menudefine "Option ~1" "Option ~2" "~Enable more Options" "-" "Option ~3" "Option ~4"
  363.  menuitemstat 4 2     ;4 is the menu item, 2 means to hide it (1 disables)
  364.  menuitemstat 5 2     ;hide item 5
  365.  menuitemstat 6 2     ;hide item 6
  366.  
  367.  menuboxv "Box Menu courtesy of MENUBOXV"
  368.  
  369.  if $MENUSELECTION = 3  ;3 is the 'Enable more Options' item
  370.   menuitemstat 3 1      ;1 disables item 3
  371.   menuitemstat 4 0      ;0 means to UNhide and enable an item
  372.   menuitemstat 5 0
  373.   menuitemstat 6 0
  374.   cls
  375.   print "Two more menu items and a menu divider line which were previously hidden have"
  376.   print "now been displayed.  And ^BEnable more Options^B has been disabled."
  377.   menuboxv "Same Menu courtesy of MENUBOXV" "Divider lines can also be hidden"
  378.  endif
  379.  
  380.   ;regardless of whether items are hidden or disabled, $MENUSELECTION is
  381.   ; ALWAYS set to the same menu item number, as if the items were not hidden
  382.   ; (ignoring menu lines though).  So 3 is still 'Enable more Options', 4 is
  383.   ; 'Option 3', etc., regardless of what is actually displayed on the screen.
  384.   ; Thus you needn't "keep track" of which items you've hidden and which
  385.   ; you haven't (the user simply cannot see or select a hidden item).
  386.  
  387.  print
  388.  if $MENUSELECTION = 0 print "You pressed the ^BEsc^B key!"
  389.  if $MENUSELECTION = 1 print "You selected ^BOption 1^B."
  390.  if $MENUSELECTION = 2 print "You selected ^BOption 2^B."
  391.  if $MENUSELECTION = 4 print "You selected ^BOption 3^B."
  392.  if $MENUSELECTION = 5 print "You selected ^BOption 4^B."
  393.  
  394.  gosub PressKey
  395.  
  396.  cls
  397.  print "There are also several 'pre-fabricated' interactive commands available."
  398.  print "Many script commands which take arguments or 'parameters' will prompt the"
  399.  print "user for input if you omit the key parameter.  For example the ^BDOWNLOAD^B"
  400.  print "command is normally followed by a protocol letter (^BDOWNLOAD ^"Z^"^B downloads"
  401.  print "using Zmodem).  If you omit the protocol letter, Icom displays the protocol"
  402.  print "menu and allows the user to select the protocol.  The same applies to all"
  403.  print "these commands, if you omit the key parameter:^M^J"
  404.  
  405.  print "^BDIAL^B       Displays the BBS Directory, allows one or more BBS's to be dialed."
  406.  print "^BDOWNLOAD^B   Prompts the user for a protocol and/or the filename to download."
  407.  print "^BFILEMAN^B    Displays the File Manager (any filespec; C:\ICOM\*.BAT, etc)"
  408.  print "           and allows the user to Copy, Move, Rename, Delete files, or"
  409.  print "           to search the disk for a file."
  410.  print "^BUPLOAD^B     Prompts the user for a protocol and/or the filename(s) to upload."
  411.  print "^BSCRIPT^B     Displays the Script Manager, allows the user to select one or"
  412.  print "           more scripts to run."
  413.  print "^BSENDKEYS^B   Sends ^Bany^B keystrokes to the Icom key handler to display any"
  414.  print "           Icom menu and to even send specific keys to the menu (macros)."
  415.  print "^BSETCOMM^B    Displays the Port Settings menu to change port speed, etc."
  416.  
  417.  gosub PressKey
  418.  
  419.  print "There are also a few interactive File Tagger-oriented commands which"
  420.  print "allow you to display records for Editing (^BCEDITREC^B) and to prompt the"
  421.  print "user for a new sort order (^BCSETSORT^B), or to prompt for a text file"
  422.  print "and/or BIF to import or export records to (^BCEXPORT^B, ^BCIMPORTTEXT^B)."
  423.  
  424.  print "With these interactive commands, and all the menu and regular keyboard"
  425.  print "input functions, along with other script commands, you can easily define"
  426.  print "quite sophisticated user interfaces for your scripts!^M^J"
  427.  
  428.  print "Of course, you don't have to interact with the user at all if you don't want"
  429.  print "to (or don't have to).  That's the whole point of scripts: everything is"
  430.  print "designed by ^Byou^B, so Intellicomm operates as you see fit.  You run the"
  431.  print "entire show."
  432.  
  433.  gosub PressKey
  434.  
  435.  WNDCLOSE
  436.  return
  437.  
  438. ;----------------------------------------------------------------------------
  439. DOSDemo:
  440. ;----------------------------------------------------------------------------
  441.  
  442.  wndopen "DOS/File Commands"
  443.  
  444.  print "Using the DOS-oriented script commands, you can do anything from displaying"
  445.  print "a directory to copying, renaming, moving or deleting files, to searching"
  446.  print "an entire disk for a file, to running Lotus from a script.^M^J"
  447.  
  448.  print "The ^BFINDFIRST^B command takes any filespec (drive, path and/or filename"
  449.  print "including wildcard ^B*^B/^B?^B support) and locates the first matching file."
  450.  print "To obtain the next file matching the filespec (if any) ^BFINDNEXT^B is used."
  451.  print "FINDFIRST/FINDNEXT also set certain script variables to allow you to"
  452.  print "check the size, date, time, and attributes of the file (read only, hidden,"
  453.  print "system, subdirectory, archive attribute).^M^J"
  454.  
  455.  print "We'll use FINDFIRST/FINDNEXT to show you all files in your root directory,"
  456.  print "including any hidden files."
  457.  
  458.  gosub PressKey
  459.  wndclose
  460.  
  461.  findfirst name fspec 8   ;8 = get the Volume ID
  462.  assign s "Filespec " fspec " on Volume " name
  463.  wndopen s 1 1 80 25
  464.  
  465.  print "   ^BFilename      Size      Date     Time   RHSA^B"
  466.  window 3 3 79 24   ;to lock the title above (which is on row 2)
  467.  
  468.  assign i 0
  469.  FINDFIRST name fspec 23       ;23 = all attributes except Volume ID
  470.  
  471.  WHILE $errorlevel = 0
  472.   strpad name " " 12           ;pad right side w/spaces up to 12 chars
  473.   if $FSUBDIR = "+"             ;is this file a subdirectory?
  474.    assign size " <DIR>"
  475.    strpad size " " 10           ;pad right side w/spaces up to 10 chars
  476.   else
  477.    assign size $FSIZE
  478.    strpadl size " " 10          ;pad left side w/spaces up to 10 chars
  479.   endif
  480.   print name size "  " $FDATE "  " $FTIME "  " $FRDONLY $FHIDDEN $FSYSTEM $FARCH
  481.   inc i
  482.   if i = 21
  483.    pause "^BPress a key... "
  484.    cls
  485.    assign i 0
  486.   endif
  487.   FINDNEXT name
  488.  ENDWHILE
  489.  
  490.  pause "^BPress a key... "
  491.  
  492.  wndclose
  493.  return
  494.  
  495. ;----------------------------------------------------------------------------
  496. CatDemo:
  497. ;----------------------------------------------------------------------------
  498.  
  499.  wndopen "Catalog Commands"
  500.  print "The catalog-oriented script commands allow you to directly manipulate any"
  501.  print "File Tagger catalog.  You can access and modify (or display, or do anything"
  502.  print "else you can dream up) each and every 'record' in the catalog.  You can"
  503.  print "tag files (based on some automated criteria such as keywords in the file"
  504.  print "description or the like) with ^BCTAGREC^B, you can note files with ^BCNOTEREC^B:"
  505.  print "You can basically do anything the File Tagger can do -- but you can do it"
  506.  print "AUTOMATICALLY via a script, instead of doing it manually in the Tagger.^M^J"
  507.  
  508.  print "To access a catalog you simply open it with ^BCOPEN^B, set the sort order (if
  509.  print "desired) with ^BCSETSORT^B, then use ^BCGETREC^B to load individual records
  510.  print "from the catalog.  We'll do just that right now to your ^BNEWFILES^B catalog
  511.  print "to display it.  Press the ^B[Esc]^B key when you've seen enough.
  512.  
  513.  gosub PressKey
  514.  wndclose
  515.  
  516.  wndopen catalog 1 1 80 25
  517.  copen catalog
  518.  csetsort                      ;no sort order specified, prompts user for
  519.                                ; sort order
  520.  
  521.  print " ^BFilename        Date                    Description^B"
  522.  window 2 3 79 24
  523.  
  524.  assign $KEY_CHECK 0           ;or the script processor gobbles up most keys
  525.                                ; before INKEY sees it
  526.  WHILE 1
  527.   inkey key
  528.   if key = "^[" break          ;^[ = ESC
  529.   cgetrec
  530.   if $errorlevel <> 0 break    ;end of catalog
  531.   assign tag " "               ;default (untagged)
  532.   if $CTAG_FLD = "T" assign tag "^P"
  533.   if $CTAG_FLD = "N" assign tag "»"
  534.   assign name $CNAME_FLD
  535.   strpad name " " 14           ;pad the name field with spaces to 14 chars
  536.   cdate2date date $CFDATE_FLD
  537.   cgetdesc desc 1
  538.   print "^B" tag "^B" name date "  " desc
  539.  ENDWHILE
  540.  
  541.  assign $KEY_CHECK 1
  542.  cclose
  543.  pause "^M^J^BPress a key..."
  544.  
  545.  wndclose
  546.  return
  547.  
  548. ;----------------------------------------------------------------------------
  549. RunScript:
  550. ;----------------------------------------------------------------------------
  551.  
  552.  wndopen "Run another Script"
  553.  
  554.  print "When you run a script ^Bfrom^B a script, or call up the Script Manager to"
  555.  print "run another script as we'll be doing here, it is possible to exit the"
  556.  print "script processor (and this demonstration) entirely.  Two commands end"
  557.  print "a script: ^BRETURN^B and ^BEXIT^B.  If the script you run contains an"
  558.  print "^BEXIT^B command, you will exit the script processor entirely (which"
  559.  print "can be handy in your own scripts, when an error warrants it).  If the"
  560.  print "script you run exits via a ^BRETURN^B command, you will return to the"
  561.  print "Main Menu of this demonstration.  ^B" $SCRIPT_NAME "^B exits with an ^BEXIT^B"
  562.  print "command, so you will exit the script processor entirely if you run
  563.  print "another copy of ^B" $SCRIPT_NAME "^B.^M^J"
  564.  
  565.  pause "Press a key to enter the Script Manager... "
  566.  
  567.  script   ;no scriptname given... this calls up the Script Manager
  568.  
  569.  pause "Welcome back to SCRDemo!.  Any key returns to the Main Menu... "
  570.  return
  571.  
  572. ;----------------------------------------------------------------------------
  573. FindScriptDOC:
  574. ;----------------------------------------------------------------------------
  575.  
  576.  wndopen
  577.  print "There's much ^BMUCH^B more to scripts than was demonstrated here, and"
  578.  print "you'll discover all the tricks of the trade by spending a few minutes"
  579.  print "with ^B" SCRTUTOR "^B.  In fact, I can take a look on-disk for ^B" SCRTUTOR
  580.  print "right now if you like, and display it for you to take a quick peek at.^M^J"
  581.  
  582.  print "Using the script ^BDISKFIND^B command, scripts can search the entire"
  583.  print "disk drive for a file (or filespec... ^B*.DOC^B for example), and
  584.  print "using the script ^BLIST^B command, files can be displayed for viewing.^M^J"
  585.  
  586.  printnc "Okay to look for ^B" SCRTUTOR "^B and display it?  "
  587.  
  588.  menudefine "~Yes" "~No"  ;define a Yes  No menu
  589.  menubar                  ;activate the menu
  590.  
  591.  if $MENUSELECTION = 1
  592.   msgopen "Searching disk for " SCRTUTOR
  593.   diskfind s SCRTUTOR    ;if found, the full pathname is stored in 's'
  594.   msgclose
  595.  
  596.   if $ERRORLEVEL = 0
  597.    print "^M^J^JWell, I found: ^B" s
  598.    pause "I hope it's the right ^B" SCRTUTOR "^B! <grin>  Press a key to view it... "
  599.  
  600.    timer          ;time how long the user spends in SCRTUTOR.DOC
  601.    LIST s         ;display the file
  602.    timertotal i   ;store total time (in tenths of a second) in v1
  603.    div i i 10     ;i = i divided by 10 (convert tenths to seconds)
  604.  
  605.    print "^M^JYou spent ^B" i "^B seconds in ^B" SCRTUTOR "^B, according to ^BTIMER^B / ^BTIMERTOTAL^B."
  606.    pause "I hope you found it interesting!  Please press a key to continue... "
  607.   else
  608.    msgwind "Unable to locate " SCRTUTOR  ;MSGOPEN, delay, MSGCLOSE
  609.    print "^M^JCheck your original disks (or .ZIPs).  " SCRTUTOR "should have been"
  610.    print "included with Intellicomm, but you may have chosen not to install the"
  611.    print "documentation when you installed Intellicomm."
  612.    pause
  613.   endif
  614.  endif
  615.  
  616.  wndclose
  617.  return
  618.  
  619.  
  620. ;----------------------------------------------------------------------------
  621. ExitDemo:
  622. ;----------------------------------------------------------------------------
  623.  
  624.  cls
  625.  wndopen "Thanks for watching!"
  626.  print
  627.  print "This concludes the demonstration.  To see how the all the features of this"
  628.  print "demonstration were accomplished, just ^BEdit^B SCRDEMO.SCR from the Icom"
  629.  print "^BScript Manager^B.  Bye for now!^M^J"
  630.  
  631.  pause "Press a key to exit... "
  632.  wndclose
  633.  gosub CleanUp
  634.  
  635.  exit
  636.