home *** CD-ROM | disk | FTP | other *** search
/ Chip 2006 February (Special) / Chip-Special_2006-02_Nero-7.bin / vypalovaci_utility / subtitle_workshop / SubtitleWorkshop251.exe / PascalScripts / Randomize.pas < prev    next >
Pascal/Delphi Source File  |  2004-01-15  |  2KB  |  58 lines

  1. // -------------------------------------------------------------------------- //
  2. //            Subtitle Workshop - Randomize subtitles pascal script           //
  3. //                        Copyright ⌐ 2001-2004 URUSoft                       //
  4. //                           http://www.urusoft.net                           //
  5. //                                                                            //
  6. // This script will randomize the positions of all the subtitles in a file.   //
  7. // The purpose of it is to be able to go through a subtitle file, correcting  //
  8. // grammar/spelling mistakes without knowing really what is happening in the  //
  9. // movie.                                                                     //
  10. //                                                                            //
  11. // Usage: first, use this randomize script via Tools/Pascal scripts menu,     //
  12. //        then correct the subtitles and then sort them again using "Sort"    //
  13. //        feature.                                                            //
  14. //                                                                            //
  15. // -------------------------------------------------------------------------- //
  16.  
  17. program RandomizeSubs;
  18.  
  19. // -----------------------------------------------------------------------------
  20.  
  21. var
  22.   i              : Integer;
  23.   r              : Integer;
  24.   Count          : Integer;
  25.   tmpInitialTime : Integer;
  26.   tmpFinalTime   : Integer;
  27.   tmpText        : String;
  28.   tmpTrans       : String;
  29. begin
  30.   Count := GetSubtitleCount;
  31.  
  32.   for i := 0 to Count-1 do
  33.   begin
  34.     Randomize;
  35.     r := Random(Count-1);
  36.  
  37.     // Exchange subtitles
  38.     tmpInitialTime := GetSubtitleInitialTime(i);
  39.     tmpFinalTime   := GetSubtitleFinalTime(i);
  40.     tmpText        := GetSubtitleText(i);
  41.     tmpTrans       := GetSubtitleTrans(i);
  42.  
  43.     SetSubtitleInitialTime(i, GetSubtitleInitialTime(r));
  44.     SetSubtitleFinalTime(i, GetSubtitleFinalTime(r));
  45.     SetSubtitleText(i, GetSubtitleText(r));
  46.     SetSubtitleTrans(i, GetSubtitleTrans(r));
  47.  
  48.     SetSubtitleInitialTime(r, tmpInitialTime);
  49.     SetSubtitleFinalTime(r, tmpFinalTime);
  50.     SetSubtitleText(r, tmpText);
  51.     SetSubtitleTrans(r, tmpTrans);
  52.   end;
  53. end.
  54.  
  55. // -----------------------------------------------------------------------------
  56.  
  57. end.
  58.