home *** CD-ROM | disk | FTP | other *** search
/ ST-Computer Leser 2002 January / STC_CD_01_2002.iso / APP / ANIPL218 / SCRIPTS / CONVERTD.SIC < prev    next >
Encoding:
Text File  |  2001-05-30  |  2.0 KB  |  90 lines

  1. if(address("aniplay"))
  2. {
  3.     choice=dialog.note("File conversions",
  4.                        "[1] MPG in MOV",
  5.                        "[2] MPG in AVI",
  6.                        "[3] MP3 in WAV or WAV in MP3",
  7.                        "-b3","-b2","-b1");
  8.     if(choice != "3")
  9.         {
  10.         title="Directory of MPG source file";
  11.         select="*.MPG";
  12.         if(choice == "1")
  13.             type_target="mov";
  14.         else
  15.             type_target="avi";
  16.     }
  17.     else
  18.     {
  19.         choice=dialog.note("Sound conversion",
  20.                            "[1] MP3 in WAV",
  21.                            "[2] WAV in MP3",
  22.                            "-b2","-b1");
  23.         if(choice == "1")
  24.             {                           
  25.             title="Directory of MP3 source file";
  26.             select="*.MP3";
  27.             type_target="wav";
  28.         }
  29.         else
  30.             {                           
  31.             title="Directory of WAV source file";
  32.             select="*.WAV";
  33.             type_target="mp3";
  34.         }        
  35.     }
  36.     if(fsel(file, title, select))
  37.     {
  38.         path=path(file);
  39.         ret=filelist(array,path);
  40.         if(ret)
  41.         {
  42.             for(j=0 ; j<ret ; j++)
  43.             {
  44.                 if(!stricmp(suffix(array[j,0]),suffix(select)))
  45.                 {
  46.                     fname="";
  47.                     strcat(fname,path,array[j,0]);
  48.                     space=0;
  49.                     for(i=0;i<strlen(fname);i++)
  50.                     {
  51.                          if(fname[i] == ' ')
  52.                              space=1;
  53.                     }
  54.                     if(space)
  55.                         quote="\047";
  56.                     else
  57.                         quote="";
  58.                     target = substr(fname,0,strlen(fname)-3) + type_target;
  59.                     cmdline = "+o " + quote + target + quote + " " + quote + fname + quote;  
  60.                     Open(cmdline);
  61.                     printf("\033EConvert <%s>\n",array[j,0]);
  62.                     wait(200);
  63.                     do
  64.                     {        
  65.                         info=ControlPlay(0);
  66.                         frequency_file=int(info[7]);
  67.                         total_samples=int(info[9]);
  68.                         count_seconds=int(info[12]);
  69.                         play=int(info[14]);
  70.                         percent=0;
  71.                         if((total_samples/frequency_file)!=0)
  72.                             percent=(count_seconds*100)/(total_samples/frequency_file);
  73.                         printf("\r[");
  74.                         for(i=0 ; i<50 ; i++)
  75.                         {
  76.                             if((i+i)<percent)
  77.                                 printf("+");
  78.                             else
  79.                                 printf(" ");
  80.                         }
  81.                         printf("]");
  82.                         wait(100);
  83.                     }
  84.                     while(play==1);
  85.                 }                
  86.             }
  87.         }
  88.  
  89.     }
  90. }