home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / int_e.lzh / e.cmd < prev   
OS/2 REXX Batch file  |  1993-11-26  |  2KB  |  46 lines

  1. /*****************************************************************************/
  2. /* Intelligent E                             (c) 1993 by Carsten Wimmer      */
  3. /* For use with Rexx/2                                   cawim@train.fido.de */
  4. /*****************************************************************************/
  5. /* This is a small rexx script that blows some intelligence into the         */
  6. /* system editor of OS/2. I always hated E for asking me to associate        */
  7. /* a file type. This script takes care of the file type and prevents E       */
  8. /* from asking anymore.                                                      */
  9. /* Send suggestions and bug-reports to my email address.                     */
  10. /*****************************************************************************/
  11.  
  12. /* Load the system functions */
  13. Call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  14. Call SysLoadFuncs
  15.  
  16. /* Get the filename from the command-line and convert it to upper case */
  17. parse upper arg file
  18.  
  19. /* Save the extension for later reference (only if there is one!) */
  20. if length(file) > 4 then do
  21.   len = length(file)-4
  22.   ext = delstr(file, 1, len)
  23. end
  24. else ext = "foobar"       /* No extension. It's a plain text! */
  25.  
  26. /* If there is already an associated file type, skip the rest */
  27. call SysGetEA file, ".TYPE", "typeinfo"
  28. parse var typeinfo 11 oldtype
  29. if oldtype == "" then do
  30.  
  31. /* Set file type according to the extension */
  32.   if ext = ".CMD" then newtype = "OS/2 Command File"
  33.   else if ext = ".BAT" then newtype = "DOS Command File"
  34.        else newtype = "Plain Text"
  35.  
  36. /* Create EA data */
  37.   EAdata = 'DFFF00000100FDFF'x || d2c(length(type)) || '00'x || newtype
  38. /* Write EA data to the file */
  39.   call SysPutEA file, ".TYPE", EAdata
  40. end
  41.  
  42. /* Finally, start E */
  43. 'start "E" /fg c:\os2\e.exe' file
  44.  
  45. /* EOF */
  46.