home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 9 Archive / 09-Archive.zip / wuz131.zip / Open-Dir.Cmd < prev    next >
OS/2 REXX Batch file  |  1994-04-17  |  2KB  |  59 lines

  1. /* Open folder on desktop from command-line */
  2. /* (c) Copyright 1994 Scott Maxwell.        */
  3.  
  4. /* Note: If you installed this with WUZ, this file */
  5. /*       may have also been created as OD.CMD      */
  6. /*       In that case, you can easily open folders */
  7. /*       on your desktop by typing something like  */
  8. /*       'od c:\os2'                   */
  9.  
  10.  
  11. parse arg Name
  12.  
  13. if (Left(Name,1) = '/') | (Left(Name,1) = '-') then
  14.   parse var Name Options Name
  15. else
  16.   Options = ''
  17.  
  18. Name = Strip(Name,,'"')
  19. Options = Translate( Options )
  20.  
  21. if Options \= '' then
  22.   if (Options \= '/C') & (Options \= '-C') then do
  23.     say "USAGE: Open-Dir [-c] [directory-name]"
  24.     say "  Opens the specified directory as a folder on the desktop"
  25.     say "  If no directory-name is specified, the current directory is opened"
  26.     say "  If -c option is specified, the current directory is changed"
  27.     exit(0)
  28.     end
  29.  
  30. Dir.1 = DIRECTORY()
  31. Dir.2 = ''
  32. if Name \= '' then
  33.   if SubStr(Name,2,1) = ':' then do
  34.     Dir.2 = DIRECTORY(Left(Name,2))
  35.     Name = SubStr(Name,3)
  36.     end
  37.  
  38. Name = Directory(Name)
  39.  
  40. CALL RxFuncAdd 'SysSetObjectData','RexxUtil','SysSetObjectData'
  41. CALL SysSetObjectData Name,"OPEN=ICON"
  42. if Options = '' then do
  43.   if Dir.2 \= '' then call Directory(Dir.2)
  44.   call Directory(Dir.1)
  45.   end
  46.  
  47. exit(0)
  48.  
  49.  
  50. Directory: procedure
  51.   arg Name
  52.   Name = Strip(Name,,'"')
  53.   if Length(Name) > 3 then
  54.     if Right(Name,1) = '\' then
  55.       Name = Left(Name,LENGTH(Name)-1)
  56.  
  57.   n = 'DIRECTORY'(Name)
  58. return n
  59.