home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!airgun!airgun.wg.waii.com!bab
- From: bab@se39.wg2.waii.com (Brian Button)
- Newsgroups: comp.os.os2.misc
- Subject: REXX Script to Add New File Types
- Message-ID: <BAB.92Nov9072906@se39.wg2.waii.com>
- Date: 9 Nov 92 12:29:06 GMT
- Sender: news@airgun.wg.waii.com
- Organization: Western Geophysical Exploration Products
- Lines: 59
- Nntp-Posting-Host: se39.wg2.waii.com
-
- I've seen a few questions floating around this newsgroup lately about
- people needing to know how to create a new file type for OS/2. I've
- asked this question myself a few times without getting a satisfactory
- answer.
-
- Well, I finally asked this same question in the OS/2 Support forum on
- Compuserve, and I got a REXX script written by someone over at IBM.
- This script works great, and I wanted to share it:
-
- -------------------- Cut here --------------------
- /* MAKEWPSA - Make a WorkPlace Shell File Association */
- trace O
- parse arg assoc
- if assoc='' then do
- say 'Syntax:'
- say 'MAKEWPSA <<DELETE> association name>'
- say 'Example: MAKEWPSA CUA Draw File'
- end
- else do
- call RxFuncAdd 'SysIni', 'RexxUtil', 'SysIni'
- Parse Upper Var assoc first_word .
- If first_word = 'DELETE' & Words(assoc) > 1 Then
- Do
- assoc = Subword(assoc, 2)
- Say 'Deleting Association "'assoc'"'
- rez=SysIni('USER','PMWP_ASSOC_TYPE',assoc,'DELETE:')
- End /* If .. Then Do */
- Else Do
- Say 'Adding Association "'assoc'"'
- rez=SysIni('USER','PMWP_ASSOC_TYPE',assoc,' ')
- End /* Else Do */
- If rez <> '' Then Say 'Return Code =' rez
- end
- -------------------- OK, you can stop cutting --------------------
-
- To use it, from an OS/2 command line, type makewpsa C++ Code, for
- instance. Once the new file type is created, it will show up in the
- Association page of the Settings notebook dialog for several types of
- files. To use it, associate a data file and a program with this file
- type and double click on the data file. It should start up in the
- appropriate program!
-
- The only problem I had was with a C++ Code file I set up on my
- desktop. I created this new icon, which was associated with GNU emacs,
- and double clicked on it. When Emacs started up, it had parsed the
- desktop path into three separate components, due to the embedded
- spaces, plus the file I wanted to edit. My workaround to this was to
- put source files somewhere other than my desktop and get at them
- through the Drives folder.
-
- bab
- --
- |-----------------------|----------------------------------------------------|
- | Brian Button | email : button@wg2.waii.com |
- | Design Engineer | 71023.276@compuserve.com |
- | Western Geophysical | voice : (713)964-6221 |
- | 3600 Briarpark |----------------------------------------------------|
- | Houston, Texas 77042 | Opinions Be Mine!! |
- |-----------------------|----------------------------------------------------|
-