home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD1.iso / FileMover / Dopus4 / ArexxScripts / psn-dpck.lha / DOpusPakken / Rexx / ComToName.Rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  1995-07-15  |  2.0 KB  |  64 lines

  1. /* This script is for DirectoryOpus V4+ (not 5.0),
  2.    it'll bring up a rename requester,
  3.    with the files comment as content
  4.  
  5.    Need no arguments or flags, but RexxReqTools.library
  6.  
  7. $VER: ComToName V1.0 (6-Jul-95) Allan Odgaard
  8.  
  9. +--------------------------------------------------------------------------+
  10. |  This is supposed to work together with a "File_Id.Diz -> Comment" prg.  |
  11. |(Check out my DizRespect.Exe which will strip any logo in the File_Id.Diz)|
  12. +--------------------------------------------------------------------------+*/
  13.  
  14. Options Results
  15. Call AddLib("rexxreqtools.library",0,-30,0)
  16.  
  17. lf = '0a'x
  18.  
  19. Status 3
  20. ActiveWin = Result
  21.  
  22. Status 13 ActiveWin
  23. DirPath = Result
  24.  
  25. Query ScreenName
  26. PubScreen = Result
  27. Victims = 0
  28.  
  29. Loop:    GetNextSelected
  30.     Name = Result
  31.     If Name = 0 Then Do
  32.     If Victims > 0 Then Do
  33.     Rescan;End;Exit;End
  34.  
  35.     Base = Left(Name,Length(Name)-Verify(Reverse(Name),'.',M))
  36.     Ext  = Right(Name,Verify(Reverse(Name),'.',M))
  37.  
  38.     Address Command 'C:List "'DirPath || Name'" LFormat %c >T:Comment.Tmp'
  39.     Open('Com','T:Comment.Tmp','R')
  40.     Comment = ReadLn('Com')
  41.     Close('Com')
  42.     Delete('T:Comment.Tmp')
  43.  
  44. Ask:    Busy On
  45.     Call rtgetstring(Comment,"Enter New Name For: "Base,"Directory Opus Request","_Ok|_Skip|_Cancel","RTEz_Flags=EZReqF_CenterText RT_ReqPos=ReqPos_CenterScr RT_PubScrName="PubScreen)
  46.     NewName = Result
  47.     Busy Off
  48.     If RTResult = 0 Then Do;If Victims > 0 Then Do;Rescan;End;Exit;End
  49.     If RTResult = 2 Then Signal Skip
  50.  
  51.     Address Command 'C:Rename "'DirPath || Name'" "'DirPath || NewName || Ext'" Quiet'
  52.     If RC > 19 Then Do
  53.         Call rtezrequest("An error occured renaming" Name lf"Maybe the object name is invalid???","_Retry|_Skip|_Cancel","Directory Opus Request","RTEz_Flags=EZReqF_CenterText RT_ReqPos=ReqPos_CenterScr RT_PubScrName="PubScreen)
  54.         If RTResult = 0 Then Do
  55.             If Victims > 0 Then Do;Rescan;End;Exit;End
  56.         If RTResult = 1 Then Do
  57.         Comment = NewName;Signal Ask;End
  58.         If RTResult = 2 Then Signal Skip
  59.     End
  60.  
  61.     Victims = Victims + 1
  62. Skip:    SelectFile '"'Name'"' 0 1
  63.     Signal Loop
  64.