home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / os / os2 / misc / 35880 < prev    next >
Encoding:
Text File  |  1992-11-09  |  2.9 KB  |  71 lines

  1. Path: sparky!uunet!airgun!airgun.wg.waii.com!bab
  2. From: bab@se39.wg2.waii.com (Brian Button)
  3. Newsgroups: comp.os.os2.misc
  4. Subject: REXX Script to Add New File Types
  5. Message-ID: <BAB.92Nov9072906@se39.wg2.waii.com>
  6. Date: 9 Nov 92 12:29:06 GMT
  7. Sender: news@airgun.wg.waii.com
  8. Organization: Western Geophysical Exploration Products
  9. Lines: 59
  10. Nntp-Posting-Host: se39.wg2.waii.com
  11.  
  12. I've seen a few questions floating around this newsgroup lately about
  13. people needing to know how to create a new file type for OS/2. I've
  14. asked this question myself a few times without getting a satisfactory
  15. answer.
  16.  
  17. Well, I finally asked this same question in the OS/2 Support forum on
  18. Compuserve, and I got a REXX script written by someone over at IBM.
  19. This script works great, and I wanted to share it:
  20.  
  21. -------------------- Cut here --------------------
  22. /* MAKEWPSA - Make a WorkPlace Shell File Association */
  23. trace O
  24. parse arg assoc
  25. if assoc='' then do
  26.   say 'Syntax:'
  27.   say 'MAKEWPSA <<DELETE> association name>'
  28.   say 'Example: MAKEWPSA CUA Draw File'
  29.   end
  30. else do
  31.   call RxFuncAdd 'SysIni', 'RexxUtil', 'SysIni'
  32.    Parse Upper Var assoc first_word .
  33.   If first_word = 'DELETE' & Words(assoc) > 1 Then
  34.     Do
  35.       assoc = Subword(assoc, 2)
  36.       Say 'Deleting Association "'assoc'"'
  37.       rez=SysIni('USER','PMWP_ASSOC_TYPE',assoc,'DELETE:')
  38.     End /* If .. Then Do */
  39.   Else Do
  40.     Say 'Adding Association "'assoc'"'
  41.     rez=SysIni('USER','PMWP_ASSOC_TYPE',assoc,' ')
  42.    End /* Else Do */
  43.  If rez <> '' Then Say 'Return Code =' rez
  44. end
  45. -------------------- OK, you can stop cutting --------------------
  46.  
  47. To use it, from an OS/2 command line, type makewpsa C++ Code, for
  48. instance. Once the new file type is created, it will show up in the
  49. Association page of the Settings notebook dialog for several types of
  50. files. To use it, associate a data file and a program with this file
  51. type and double click on the data file. It should start up in the
  52. appropriate program!
  53.  
  54. The only problem I had was with a C++ Code file I set up on my
  55. desktop. I created this new icon, which was associated with GNU emacs,
  56. and double clicked on it. When Emacs started up, it had parsed the
  57. desktop path into three separate components, due to the embedded
  58. spaces, plus the file I wanted to edit. My workaround to this was to
  59. put source files somewhere other than my desktop and get at them
  60. through the Drives folder.
  61.  
  62. bab
  63. --
  64. |-----------------------|----------------------------------------------------|
  65. | Brian Button          | email : button@wg2.waii.com                        |
  66. | Design Engineer       |         71023.276@compuserve.com                   |
  67. | Western Geophysical   | voice : (713)964-6221                              |
  68. | 3600 Briarpark        |----------------------------------------------------|
  69. | Houston, Texas  77042 |                  Opinions Be Mine!!                |
  70. |-----------------------|----------------------------------------------------|
  71.