home *** CD-ROM | disk | FTP | other *** search
- //////////////////////////////////////////////////////////////////////////////
- // //
- // SENDLOOP.SLT Telix 3.15 Script //
- // //
- // A script to display all the files in your "Upload" directory in a //
- // window with a white background... unless you're using a white back- //
- // ground, in which case it will use a cyan background. The window will //
- // adjust itself to show a maximum of ten files before scrolling the file //
- // list. The total number of files in the directory will be displayed on //
- // the top border line of the window. //
- // //
- // I wrote this script as an exercise, and as the rudiments to a similar //
- // function I need for a file transfer automation utility I'm working on //
- // in my "spare time". //
- // //
- // There's a version with a "Pause" instead of the Auto-Scroll called //
- // "SENDPAWS.SLT" if you're interested (actually it exists even if you're //
- // NOT interested!)... //
- // //
- // Make any (and ALL) changes that you need and/or desire and recompile //
- // this script. I then assign it to a Function Key. Personally I use //
- // F12 for this script (I use Shift+F12 for the "RecvLoop" script). //
- // //
- // This script is "thrown" into the Public Domain! I use it, but take //
- // NO RESPONSIBILITY for it! It's behaved for me, but who knows what //
- // it'll do away from home! //
- // //
- //////////////////////////////////////////////////////////////////////////////
-
-
- //////////////////////////////////////////////////////////////////////////////
- // //
- // Any/All questions, comments, words of high praise can be addressed to: //
- // //
- // Mr. Jiggs (Systems Overlord) //
- // c/o Fotobeam/Brookside, Inc. //
- // 260 Lexington St. //
- // Waltham, Ma. 02254-4613 //
- // //
- // Voice: (617) 893-1600 //
- // Fax: (617) 893-9951 //
- // BBS: (617) 893-6812 8n1 //
- // Up To 9600baud v.32/v.42bis/MNP //
- // //
- //////////////////////////////////////////////////////////////////////////////
-
-
- main() {
- int File_Count=0, Back_Color=0, Listing_Loop=0;
- int Top_Row=0, Box_Row=0, Orig_Row=0, Orig_Col=0, Result=0;
- str Found[16], Look_For[64], Directory_Name[64], Num[3];
-
- cursor_onoff(0); // Begin by turning the cursor off...
- Orig_Col=getx(); // Save the cursor position you entered
- Orig_Row=gety(); // from (to restore upon exiting)...
-
- If (_back_color == 07) // Check to see if you're using a white
- Back_Color=48; // background & assign CYAN if you are,
- Else // OTHERWISE...
- Back_Color=112; // assign a WHITE window background...
-
- Directory_Name=_Up_Dir; // Set the Directory_Name variable to
- Look_For=Directory_Name; // your "Telix Upload Directory Name"
- strcat(Look_For, "*.*"); // & add the "*.*" wild card to it...
-
- while (FileFind(Look_For,0,Found) != 0) // "Loop" through the "Upload
- { // Directory" counting the
- File_Count=File_Count+1; // number of files...
- Look_For="";
- }
-
- ///////////////////////////////////////////////////////////////////////////////////////////////
- // If the directory's empty (you don't have ANY files in your "Upload Directory")... //
- // The script will display the directory name within the window and display //
- // " 0 Files ", but if you remove the beginning "//" from the following section it //
- // will skip this entirely, which might make you think this isn't working... //
- ///////////////////////////////////////////////////////////////////////////////////////////////
-
- // If (File_Count == 0) { // If there's no files here
- // gotoxy(Orig_Col, Orig_Row); // restore the position, & turn
- // cursor_onoff(1); // the cursor back on, then
- // return -1; // exit the script...
- // }
-
- itos(File_Count, Num); // Convert the File Count to a
- // String (for display purposes)
- Listing_Loop=0; // then reset the variables to
- if (Directory_Name == "") // Loop again for the actual
- Directory_Name=_Up_Dir; // display...
- Look_For=Directory_Name;
- strcat(Look_For, "*.*");
-
- If (File_Count < 10) // If there's less than 10 files
- Box_Row=20-File_Count; // set the top row of the window
- Else // on screen row 20 minus the #
- Box_Row=10; // of files, OTHERWISE set it at
- // row 10...
-
- Box(60, Box_Row, 79, 22, 3, 0, Back_Color); // Draw the window
- pstraxy(" ", 61, Box_Row, Back_Color);
- pstraxy(Num, getx(), Box_Row, Back_Color+14); // Display the File Count
- If (File_Count == 1)
- pstraxy(" File",getx(), Box_Row, Back_Color+1); // Display "File" or "Files"
- Else // depending on whether there's
- pstraxy(" Files",getx(), Box_Row, Back_Color+1); // one (1) file or not...
- pstraxy(" ", getx(), Box_Row, Back_Color);
- ++Box_Row;
-
- pstraxy(Directory_Name, 62, Box_Row, Back_Color+4); // Display the directory
- ++Box_Row; // name in the window
- Top_Row=Box_Row; // set the first row
- while (FileFind(Look_For,0,Found) != 0) { // for the scrolling list
- ++Listing_Loop; // of file names...
- If (Listing_Loop > 10) { // Test for need to scroll
- scroll(62, Top_Row, 77, Box_Row-1, 1, Back_Color+1); // scroll 1 line
- --Box_Row; // & reset the display row #
- }
- pstraxy(Found,65,Box_Row, Back_Color+1); // Display the File Name
- Look_For="";
- ++Box_Row; // Update the display row #
- }
- gotoxy(Orig_Col, Orig_Row); // Put the cursor back
- cursor_onoff(1); // where it was & turn
- } // it back on...
-