Metropoli BBS
VIEWER: mk4_ud1.xts MODE: TEXT (ASCII)
/*
	MK4_UD1.XTS
        PC MagNet Utilities Database
        command line driven down load script
        by Rick Ayre, 6.8.90
*/

if null(arg) then chain "ud2"        --if no file is entered on the
                                     --command line you must have meant
				     --to run MK4_UD2.XTS, so I do
n = 1                                
i = 0                                -- declare variables and set values
string my_file, choice, dFile[30]    -- where needed

while not null(arg(n))          -- loop to parse command line arguments
   i = i + 1                    -- increment file array counter
   dFile[i] = arg(n)            -- assign argument name to file array name
   if exists (dFile[i]) then {  -- check to see if file exists already
        cls                     -- if so leave a note and
        print "This file already exists:",dFile[i]
        print "Get others? (Y/N)"      -- ask to continue
        input choice
        i = i - 1                --dump file by decrementing array counter
        if choice = "n" then end --if user answers NO, end script
   }
   n = n + 1                     --increment argument number counter
wend

label call_magnet                -- routine to dial and log on
   if null(arg) or i = 0 then end  -- unless there are no files to down load

   load "CSERVE"                 -- Either name your dialing entry CSERVE or
   protocol "CSERVEB"            -- enter yours in it's place
   call "CSERVE"
   wait 20 ticks,
   reply
   wait for "Host Name:",
   reply "CIS"
   wait for "User ID:",
   reply "#####,###"             -- Your UserID goes in place of "#"s
   wait for "Password:",
   display off                   -- Make sure display is OFF Password is not echoed
   reply "*****.*******"         -- Your Password goes in place of "*"s
   wait 5 seconds for space chr(13),
   display on                    -- Turn display back on

repeat                           -- Loop to load file names from
   my_file = dFile[i]            -- array into string for down load
   gosub get_file                -- Jump to routine that down loads file
   i = i - 1                     -- Decrement file array counter
until i = 0                      -- Loop ends when there are no files in array

wait quiet 5 ticks : reply "OFF"    -- Quit MagNet
wait for "Host Name:" : BYE : end   -- Hang up phone line and end script

label get_file                   -- Routine to down load files
   wait quiet 5 seconds,
   reply "go pcm:utilit"
   wait for "!",
   reply "4"
   wait for "e (example, DR.COM):",
   reply my_file
   watch for                            -- This watch for traps errors that occur
      "ad this file? (Y/N)" : reply "y" -- when the file name had been spelled
       "!" : goto no_file               -- wrong or was ambiguous
   endwatch
   wait for "> to begin transfer!",
   wait quiet 5 ticks,
   Reply
   wait for "!",
   reply "5"
/* --If you are running Mk.4 v1.X you must uncomment the "if filter" line
   if filter = 'CONTROL' then fmap = fmap | 65568
*/ --To uncomment the above line simple delete the "/*" and the "*/"
   wait quiet 5 seconds,
   return                        -- Return to repeat loop

label no_file                    -- Routine to inquire how to proceed
   print "File not found!"       -- when the file was not found
   print "Continue with others? (Y/N)"
   input choice
   if choice = "n" then end
   shut                          -- Close window
   return                        -- Retrun to repeat loop
[ RETURN TO DIRECTORY ]