home *** CD-ROM | disk | FTP | other *** search
/ Enigma Amiga Life 110 / EnigmaAmiga110CD.iso / software / varie / versionwb / dopusscript / versioncomp.dopus5 next >
Text File  |  1999-12-05  |  3KB  |  82 lines

  1. /*
  2.   $VER: Dopus Mag. VersionCompare-Script 1.0 (10.11.1999) © by Wolfgang Breisch <wolfb@aon.at>
  3.  
  4.   Requires VersionWB © by Håkan Parting <hakan@parting.nu>
  5.  
  6.   Function: ARexx: VersionComp.dopus5 {Qp} COMPARE/S
  7.  
  8.   Compares the version of the selected file in source, with the same file in destination.
  9.   If no destination is defined, or "COMPARE is not set,
  10.   you get normal version-outputs of all selected files without comparing anything.
  11.  
  12. */
  13. options results
  14. options failat 99
  15. parse arg dopusport ' ' cmd .
  16. if dopusport="" then exit
  17. address value dopusport
  18. LF='0a'x
  19. if cmd="COMPARE" then do
  20.  lister query dest
  21.  if RC>0 then cmd=""
  22.   else do
  23.    parse var result dhandle
  24.    lister query dhandle path;dpath=strip(result, 'B', '"')
  25.   end
  26. end
  27. lister query source stem shandle;if RC>0 then signal error
  28.  
  29. do listloop=0 to shandle.count-1
  30.  lister query shandle.listloop selfiles stem sfiles
  31.  lister query shandle.listloop path;spath=strip(result, 'B', '"')
  32.   do selloop=0 to sfiles.count-1
  33.     lister set shandle.listloop busy on
  34.     nosel=1
  35.     lister select shandle.listloop sfiles.selloop off;lister refresh shandle.listloop all
  36.     sfile=strip(sfiles.selloop, 'B', '"')
  37.     if cmd="COMPARE" then do
  38.       lister set dhandle busy on
  39.       Address Command 'C:VersionWB >t:Version.Tmp "'spath||sfile'" Text'
  40.       Call extractver;selver=Result 
  41.       If ~Exists(dpath||sfile) Then Do;Call nofile;end
  42.        else do
  43.         Address Command 'C:VersionWB >t:Version.Tmp "'dpath||sfile'" Text'
  44.         Call extractver;destver=Result
  45.         call askuser
  46.        end
  47.     end
  48.      else address command 'C:versionwb "'spath||sfile'"'
  49.   end
  50.  lister set shandle.listloop busy off
  51. end
  52. if nosel~=1 then signal error
  53. cancle: lister set shandle.listloop busy off
  54.         if cmd="COMPARE" then do
  55.          command delete 't:Version.tmp' quiet
  56.          lister set dhandle busy off
  57.          lister read dhandle dpath;lister refresh dhandle all
  58.         end
  59.         exit
  60. askuser: dopus request '"( 'spath||sfile' ) Version: 'selver||LF||LF'( 'dpath||sfile' ) Version: 'destver||LF||LF'Would you like to copy 'LF'( 'spath||sfile' ) to ( 'dpath' ) ?"' 'Copy|Skip|Quit'
  61.          if RC=1 then do;command copy spath||sfile to dpath quiet;return;end
  62.          if RC=0 then signal cancle
  63.          return
  64. ExtractVer: Open('VerOut','T:Version.Tmp','Read')
  65. SearchLoop: If EOF('VerOut') Then Do
  66.         Close('VerOut')
  67.         Return('Unknown')
  68.         End
  69.         VerTmp=ReadLn('VerOut')
  70.         If Left(VerTmp,9) ~= "Version: " Then Signal SearchLoop
  71. FoundVer:   Version=Right(VerTmp,Length(VerTmp)-9)
  72.             Close('VerOut')
  73.             Return(Version)
  74. nofile: dopus request '"Source-File: ( 'sfile' )'LF'Version: 'selver||LF||LF'No file to compare in destination.'LF'Would you like to copy'LF'( 'sfile' ) to ( 'dpath' ) ?"' 'Copy|Skip|Quit'
  75.         if RC=1 then do
  76.          command copy spath||sfile to dpath quiet
  77.          return
  78.         end
  79.         if RC=0 then signal cancle
  80.         return
  81. error: dopus request '"No file selected."' 'OK'
  82.        exit