home *** CD-ROM | disk | FTP | other *** search
/ High Voltage Shareware / high1.zip / high1 / DIR24 / WUZ10A.ZIP / OPEN-DIR.CMD < prev    next >
OS/2 REXX Batch file  |  1993-12-08  |  1KB  |  49 lines

  1. /* Open folder from command-line */
  2. /* (c) Copyright 1993 Scott Maxwell.*/
  3.  
  4. arg Name Options
  5.  
  6. if (Left(Name,1) = '/') | (Left(Name,1) = '-') then do
  7.   swap = Name
  8.   Name = Options
  9.   Options = swap
  10.   end
  11.  
  12. if Options \= '' then
  13.   if (Options \= '/C') & (Options \= '-C') then do
  14.     say "USAGE: Open-Dir [-c] [directory-name]"
  15.     say "  Opens the specified directory as a folder on the desktop"
  16.     say "  If no directory-name is specified, the current directory is opened"
  17.     say "  If -c option is specified, the current directory is changed"
  18.     exit(0)
  19.     end
  20.  
  21. Dir.1 = DIRECTORY()
  22. Dir.2 = ''
  23. if Name \= '' then
  24.   if SubStr(Name,2,1) = ':' then do
  25.     Dir.2 = DIRECTORY(Left(Name,2))
  26.     Name = SubStr(Name,3)
  27.     end
  28.  
  29. Name = Directory(Name)
  30.  
  31. CALL RxFuncAdd 'SysSetObjectData','RexxUtil','SysSetObjectData'
  32. CALL SysSetObjectData Name,"OPEN=ICON"
  33. if Options = '' then do
  34.   if Dir.2 \= '' then call Directory(Dir.2)
  35.   call Directory(Dir.1)
  36.   end
  37.  
  38. exit(0)
  39.  
  40.  
  41. Directory: procedure
  42.   arg Name
  43.   if Length(Name) > 3 then
  44.     if Right(Name,1) = '\' then
  45.       Name = Left(Name,LENGTH(Name)-1)
  46.  
  47.   n = 'DIRECTORY'(Name)
  48.   return n
  49.