home *** CD-ROM | disk | FTP | other *** search
/ Boldly Go Collection / version40.iso / TS / 05B / TLXDIR01.ZIP / SENDLOOP.SLT < prev    next >
Encoding:
Text File  |  1992-05-27  |  7.4 KB  |  125 lines

  1. //////////////////////////////////////////////////////////////////////////////
  2. //                                        //
  3. //                       SENDLOOP.SLT Telix 3.15 Script                     //
  4. //                                        //
  5. //  A script to display all the files in your "Upload" directory in a       //
  6. //  window with a white background... unless you're using a white back-     //
  7. //  ground, in which case it will use a cyan background.  The window will   //
  8. //  adjust itself to show a maximum of ten files before scrolling the file  //
  9. //  list.  The total number of files in the directory will be displayed on  //
  10. //  the top border line of the window.                        //
  11. //                                        //
  12. //  I wrote this script as an exercise, and as the rudiments to a similar   //
  13. //  function I need for a file transfer automation utility I'm working on   //
  14. //  in my "spare time".                             //
  15. //                                        //
  16. //  There's a version with a "Pause" instead of the Auto-Scroll called      //
  17. // "SENDPAWS.SLT" if you're interested (actually it exists even if you're   //
  18. //  NOT interested!)...                             //
  19. //                                        //
  20. //  Make any (and ALL) changes that you need and/or desire and recompile    //
  21. //  this script.  I then assign it to a Function Key.  Personally I use     //
  22. //  F12 for this script (I use Shift+F12 for the "RecvLoop" script).        //
  23. //                                        //
  24. //  This script is "thrown" into the Public Domain!  I use it, but take     //
  25. //  NO RESPONSIBILITY for it!  It's behaved for me, but who knows what      //
  26. //  it'll do away from home!                                                //
  27. //                                        //
  28. //////////////////////////////////////////////////////////////////////////////
  29.  
  30.  
  31. //////////////////////////////////////////////////////////////////////////////
  32. //                                        //
  33. //  Any/All questions, comments, words of high praise can be addressed to:  //
  34. //                                        //
  35. //                 Mr. Jiggs (Systems Overlord)            //
  36. //             c/o Fotobeam/Brookside, Inc.                //
  37. //                 260 Lexington St.                    //
  38. //                 Waltham, Ma.  02254-4613                //
  39. //                                        //
  40. //                 Voice: (617) 893-1600                //
  41. //                   Fax: (617) 893-9951                //
  42. //                   BBS: (617) 893-6812   8n1            //
  43. //                       Up To 9600baud v.32/v.42bis/MNP                    //
  44. //                                                                          //
  45. //////////////////////////////////////////////////////////////////////////////
  46.  
  47.  
  48. main() {
  49.      int File_Count=0, Back_Color=0, Listing_Loop=0;
  50.      int Top_Row=0, Box_Row=0, Orig_Row=0, Orig_Col=0, Result=0;
  51.      str Found[16], Look_For[64], Directory_Name[64], Num[3];
  52.  
  53.      cursor_onoff(0);                                   // Begin by turning the cursor off...
  54.      Orig_Col=getx();                                   // Save the cursor position you entered
  55.      Orig_Row=gety();                                   // from (to restore upon exiting)...
  56.  
  57.      If   (_back_color == 07)                           // Check to see if you're using a white
  58.            Back_Color=48;                               // background & assign CYAN if you are,
  59.      Else                                               // OTHERWISE...
  60.            Back_Color=112;                              // assign a WHITE window background...
  61.  
  62.      Directory_Name=_Up_Dir;                            // Set the Directory_Name variable to
  63.      Look_For=Directory_Name;                           // your "Telix Upload Directory Name"
  64.      strcat(Look_For, "*.*");                           // & add the "*.*" wild card to it...
  65.  
  66.      while (FileFind(Look_For,0,Found) != 0)            // "Loop" through the "Upload
  67.            {                                            //  Directory" counting the
  68.              File_Count=File_Count+1;                   //  number of files...
  69.              Look_For="";
  70.            }
  71.  
  72. ///////////////////////////////////////////////////////////////////////////////////////////////
  73. //   If the directory's empty (you don't have ANY files in your "Upload Directory")...       //
  74. //         The script will display the directory name within the window and display          //
  75. //       " 0 Files ", but if you remove the beginning "//" from the following section it     //
  76. //         will skip this entirely, which might make you think this isn't working...         //
  77. ///////////////////////////////////////////////////////////////////////////////////////////////
  78.  
  79. //   If    (File_Count == 0) {                          // If there's no files here
  80. //          gotoxy(Orig_Col, Orig_Row);                 // restore the position, & turn
  81. //          cursor_onoff(1);                            // the cursor back on, then
  82. //          return -1;                                  // exit the script...
  83. //         }
  84.  
  85.      itos(File_Count, Num);                             // Convert the File Count to a
  86.                                                         // String (for display purposes)
  87.      Listing_Loop=0;                                    // then reset the variables to
  88.      if    (Directory_Name == "")                       // Loop again for the actual
  89.             Directory_Name=_Up_Dir;                     // display...
  90.      Look_For=Directory_Name;
  91.      strcat(Look_For, "*.*");
  92.  
  93.      If    (File_Count < 10)                            // If there's less than 10 files
  94.             Box_Row=20-File_Count;                      // set the top row of the window
  95.      Else                                               // on screen row 20 minus the #
  96.             Box_Row=10;                                 // of files, OTHERWISE set it at
  97.                                                         // row 10...
  98.  
  99.      Box(60, Box_Row, 79, 22, 3, 0, Back_Color);              // Draw the window
  100.      pstraxy(" ", 61, Box_Row, Back_Color);
  101.      pstraxy(Num, getx(), Box_Row, Back_Color+14);            // Display the File Count
  102.      If     (File_Count == 1)
  103.              pstraxy(" File",getx(), Box_Row, Back_Color+1);  // Display "File" or "Files"
  104.      Else                                                     // depending on whether there's
  105.              pstraxy(" Files",getx(), Box_Row, Back_Color+1); // one (1) file or not...
  106.      pstraxy(" ", getx(), Box_Row, Back_Color);
  107.      ++Box_Row;
  108.  
  109.      pstraxy(Directory_Name, 62, Box_Row, Back_Color+4);      // Display the directory
  110.      ++Box_Row;                                               // name in the window
  111.      Top_Row=Box_Row;                                         // set the first row
  112.      while (FileFind(Look_For,0,Found) != 0) {                // for the scrolling list
  113.             ++Listing_Loop;                                   // of file names...
  114.             If (Listing_Loop > 10) {                          // Test for need to scroll
  115.                 scroll(62, Top_Row, 77, Box_Row-1, 1, Back_Color+1);  // scroll 1 line
  116.                 --Box_Row;                                    // & reset the display row #
  117.                }
  118.             pstraxy(Found,65,Box_Row, Back_Color+1);          // Display the File Name
  119.             Look_For="";
  120.             ++Box_Row;                                        // Update the display row #
  121.            }
  122. gotoxy(Orig_Col, Orig_Row);                                   // Put the cursor back
  123. cursor_onoff(1);                                              // where it was & turn
  124. }                                                             // it back on...
  125.