home *** CD-ROM | disk | FTP | other *** search
/ Mega A/V / mega_av.zip / mega_av / SOUNDUTL / QUOTEME.ZIP / QUOTEME.PAS < prev   
Pascal/Delphi Source File  |  1991-04-04  |  3KB  |  114 lines

  1.  {$M $2000,0,0 }   { 16K stack, no heap }
  2. Program play_cookie;
  3.  
  4.   uses Dos;
  5.   var
  6.     DirInfo: SearchRec;
  7.     dirlist: array [1..1000] of string[12];
  8.     count,R: Word;
  9.     fname,programname, cmdline,drivepath,ext,progswitch:string[50];
  10.     fi:text;
  11.     reconfigflag:boolean;
  12.     x:integer;
  13.  
  14. Procedure Reconfigure;
  15. Begin
  16.   Writeln;
  17.   Writeln('           "Don''T quote me!!"  Setup');
  18.   Writeln;
  19.   Writeln;
  20.   Writeln('Enter the Drive\path\name of the player');
  21.   Write  ('         (EX:  C:\SOUND\VOX_KIT\VPLAY.EXE )  > ');
  22.   readln(programname);
  23.   writeln;
  24.   Writeln('Enter any command line switches for the player ');
  25.   Write  ('         (EX:  /Q )                          > ');
  26.   readln(progswitch);
  27.   Writeln;
  28.   Writeln('Enter the Drive\path\  of the sound files to play');
  29.   Write  ('         (EX:  C:\SOUND\SOUNDS\    )         > ');
  30.   readln(DRIVEPATH);
  31.   writeln;
  32.   Writeln('Enter the filter for the files to be played  ');
  33.   Write  ('         (EX:  *.VOC )                       > ');
  34.   readln(ext);
  35.   writeln;
  36.   Rewrite(fi);
  37.   WriteLn(fi,programname);
  38.   writeln(fi,drivepath);
  39.   writeln(fi,ext);
  40.   writeln(fi,progswitch);
  41.   Close(fi);
  42. end;
  43.  
  44.  
  45. function ok_start:boolean;
  46.   var
  47.     ch:char;
  48.   begin
  49.     if ParamCount>=1 then
  50.       begin
  51.          ok_start:=false;
  52.          cmdline:=paramstr(1);
  53.          ch:=upcase(cmdline[1]);
  54.          if ch='R' then reconfigure
  55.                    else writeln('Use QUOTEME R to reconfigure ');
  56.       end
  57.     else ok_start:=true;
  58.    {$I-}
  59.    Reset(fi);
  60.    readLn(fi,programname);
  61.    readln(fi,drivepath);
  62.    readln(fi,ext);
  63.    readln(fi,progswitch);
  64.    Close(fi);
  65.    {$I+}
  66.    if (IOResult <> 0) then
  67.      Begin
  68.        Writeln('Error Reading Configuration running setup!!');
  69.        reconfigure;
  70.      end;
  71.   end;
  72.  
  73.  
  74.   begin
  75.     Writeln(' "Don''t Quote Me!!" Ver 1.1 random sound player by Dennis Messer');
  76.     Writeln;
  77.     fname:=paramstr(0);
  78.     count:=length(fname);
  79.     delete(fname,count-2,3);
  80.     fname:=fname+'CFG';
  81.     assign(fi,fname);
  82.     reconfigflag:=false;
  83.     if ok_start then
  84.         Begin
  85.           randomize;
  86.           count:=1;
  87.           FindFirst(drivepath+ext, Archive, DirInfo);
  88.           if (doserror<>0) then reconfigflag:=true;
  89.           if not reconfigflag then
  90.            begin
  91.             while ((DosError = 0) and (count<=1000)) do
  92.              begin
  93.               dirlist[count]:=dirinfo.name;
  94. {              writeln(dirinfo.name);}
  95.               count:=count+1;
  96.               FindNext(DirInfo);
  97.              end;
  98.             if count>1 then
  99.              begin
  100.                R:=random(count-1)+1;
  101.                cmdline:=drivepath+dirlist[r]+' '+progswitch;
  102.                SwapVectors;
  103.                Exec(ProgramName, CmdLine);
  104.                SwapVectors;
  105.              end;
  106.            end;
  107.         end;
  108.        if reconfigflag then reconfigure;
  109.  End.
  110.  
  111.  
  112.  
  113.  
  114.