Using OS/2 REXX to modify file objects opening menu 
Author Message
 Using OS/2 REXX to modify file objects opening menu

I'm trying to `object-ize' a bunch of data files (.tex files
actually) so that when I left click on their icons I can
choose to apply one of several executables (program reference
objects) to the underlying data file.  I know how to set this
up file by file by opening and modifying the Settings page -
but what I need is a way of automating this process.      

Here's what works well for changing the EA's of a bunch of files
so that they correspond to a given template;

   parse arg filespec   /* get filespec1 and filespec2 */
   filespec = strip(filespec)    /* strip blanks for safety */
   call SysFileTree filespec , 'files', 'fo'
   do i=1 to files.0
    'copy template.txt +' files.i 'tmp'
    'copy tmp ' files.i
     'del tmp'
   end

Here template.txt is a (virtually) empty file with the right EA's.

While this is effective in setting the .TYPE and icon of a given
set of files it unfortunately does not change the opening menu of
a file to that of the template file.  Presumably this is because
this information is stored in the user .INI file rather than the
EA's of the data file.  

Anyone know how to automate the modification of the menu settings
page of data file objects?

Thanks in advance,

--
Birne Binegar
Mathematics Department, Oklahoma State University, Stillwater, OK 74078, USA



Wed, 05 Mar 1997 06:25:41 GMT  
 Using OS/2 REXX to modify file objects opening menu

: I'm trying to `object-ize' a bunch of data files (.tex files
: actually) so that when I left click on their icons I can
: choose to apply one of several executables (program reference
: objects) to the underlying data file.  I know how to set this
: up file by file by opening and modifying the Settings page -
: but what I need is a way of automating this process.      

: Here's what works well for changing the EA's of a bunch of files
: so that they correspond to a given template;

:    parse arg filespec   /* get filespec1 and filespec2 */
:    filespec = strip(filespec)    /* strip blanks for safety */
:    call SysFileTree filespec , 'files', 'fo'
:    do i=1 to files.0
:     'copy template.txt +' files.i 'tmp'
:     'copy tmp ' files.i
:      'del tmp'
:    end

: Here template.txt is a (virtually) empty file with the right EA's.

: While this is effective in setting the .TYPE and icon of a given
: set of files it unfortunately does not change the opening menu of
: a file to that of the template file.  Presumably this is because
: this information is stored in the user .INI file rather than the
: EA's of the data file.  

: Anyone know how to automate the modification of the menu settings
: page of data file objects?

: Thanks in advance,
:  

: --
: Birne Binegar
: Mathematics Department, Oklahoma State University, Stillwater, OK 74078, USA

Birne,

You can associate executables to a particular type or extension - for
example, if you want to associate say 'texp.exe' to all '*.tex' files,
you can do it as follows:

1) open the settings view of the 'texp.exe' program object;
2) go to the 'Association' page;
3) type '*.tex' in 'New name:' box and press 'Add >>' button.

This will associate texp.exe to all *.tex file.

Or, you can download 'assoedit' (Association Editor) program from
hobbes.nmsu.edu.

If you need more controls over WPS objects in Rexx (say if you want to
have a program associated with all *.tex files in a particular folder), try
MNRexx10.zip also available at hobbes.nmsu.edu - with which you can do almost
anything with WPS.

Hope this helps,

Best Regards,  Makoto Nagata



Fri, 07 Mar 1997 10:10:08 GMT  
 Using OS/2 REXX to modify file objects opening menu

Quote:

> I'm trying to `object-ize' a bunch of data files (.tex files
> actually) so that when I left click on their icons I can
> choose to apply one of several executables (program reference
> objects) to the underlying data file.  I know how to set this
> up file by file by opening and modifying the Settings page -
> but what I need is a way of automating this process.

This is not possible directly from REXX under OS.2 2.11 or earlier.  I'm
told such things are possible in Warp.  However, you might want to check out
the MNREXX utility, available via anonymous FTP from hobbes.nmsu.edu;  it
allows you to call any SOM method from REXX, which should provide you with
the capabilities you need.

Tom Bridgman - Systems Engineering Services (OS/2)

Bitnet: MRTOM at YKTVMV    IBMMAIL:  USIB53B6



Fri, 07 Mar 1997 16:42:03 GMT  
 Using OS/2 REXX to modify file objects opening menu

Quote:

> > I'm trying to `object-ize' a bunch of data files (.tex files
> > actually) so that when I left click on their icons I can
> > choose to apply one of several executables (program reference
> > objects) to the underlying data file.  I know how to set this
> > up file by file by opening and modifying the Settings page -
> > but what I need is a way of automating this process.

I can probably be done from REXX in some way, but it should be easier
to simply create the program objects pointing to the executables with
the correct parameters, and the open the associate page of the program
objects and associate them to *.tex
Then, if you rightclick on a .tex file you will find all objects
assoiated to .tex files listed under the open-selection in the order
you associated them. The first associated object will be the default.
When you choose an action the associated program object will be opened
with the datafile. I have ie my .cmd files associated to EPM, RXD, PMRexx
and the standard association as a program to run. My raytracing scenes .pov
have associtions to EPM and five different raytracing objects that runs the
same raytracing program but with different size/quality settings.
So, you actually needs to do the associations the other way around. Don't
modify the datafiles setting page. Create, or use the ones you have,
program objects and set their associations to the datafiles types.

--
Fredric Lonngren               Ericsson Telecom AB   AXE Control Systems

                           [OS/2 - Why Wait ?]



Fri, 07 Mar 1997 22:24:27 GMT  
 Using OS/2 REXX to modify file objects opening menu

Quote:

>I'm trying to `object-ize' a bunch of data files (.tex files
>actually) so that when I left click on their icons I can
>choose to apply one of several executables (program reference
>objects) to the underlying data file.  I know how to set this
>up file by file by opening and modifying the Settings page -
>but what I need is a way of automating this process.      

Did you try adding "*.tex" to the associations pages of the program
objects?


Sat, 08 Mar 1997 12:30:53 GMT  
 Using OS/2 REXX to modify file objects opening menu

: I'm trying to `object-ize' a bunch of data files (.tex files
: actually) so that when I left click on their icons I can
: choose to apply one of several executables (program reference
: objects) to the underlying data file.  I know how to set this
: up file by file by opening and modifying the Settings page -
: but what I need is a way of automating this process.      

: Anyone know how to automate the modification of the menu settings
: page of data file objects?

: Thanks in advance,
:  

: --
: Birne Binegar
: Mathematics Department, Oklahoma State University, Stillwater, OK 74078, USA

Birne,

Here is an MNRexx script to add user menu items to dropped objects:

--- cut here ---

/*** MNRexx Script: add user menu ***/

context = word(arg(1), 1)

if context \= 'DROP' then return

self = arg(2)

call RxFuncAdd 'RxmnInit', 'MNRexx', 'RxmnInit'
call RxmnInit

/*** change these to suit your needs ***/

MenuObjectName = "C:\os2\apps\epm.exe"        /*** filename or object ID ***/
MenuTitle = "Run EPM"

/*** add user menu to dropped objects ***/

MenuObject = RxmnQueryObject(MenuObjectName)

do i = 3 to arg()
        object = arg(i)

        if RxmnIsA(object, "WPFileSystem") then
        do
                id = addUserMenu(object, MenuTitle, MenuObject);
        end
end
return

addUserMenu: procedure
        parse arg object, MenuName, MenuObject
        Item = "000000000300"x || MenuObject || left(MenuName, 32, "00"x)
        return RxmnCallmethod("wpAddUserMenuItem", "LHS", object, Item)

--- cut here ---

Create an MNRexx object with this script (using 'MNREXXFILE=*' setup string).
Then modify 'MenuObjectName' and 'MenuTitle' to suit your needs.  Then
drop your data file objects on the MNRexx icon, and all dropped files will
have a user menu 'MenuTitle' which executes 'MenuObjectName' program.

Hope this helps - if you need any assistance modifying this script,
please feel free to email me.

Best Regards,  Makoto Nagata



Thu, 13 Mar 1997 18:50:05 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Using REXX to create new objects in OS/2 with Desktop Observatory

2. Possible file open problem - OS/2 classic Rexx

3. Opening file using PLAIN_TEXT_FILE or RAW_FILE and getting OS error status back

4. Problem opening files while using os.path.walk

5. OS/2 Rexx port to Object Rexx for NT

6. OS/2 Rexx port to Object Rexx for NT

7. VX-REXX and Object REXX under OS/2

8. Object REXX & VX-REXX under OS/2

9. Object Rexx Questions (opening program objects

10. OS/2 Object REXX (ORX) - how to get DLL to update REXX variable

11. Conversion OS/2 Rexx to Object Rexx for Windows '95

12. OS/2 REXX Question (Object REXX Question Inside)

 

 
Powered by phpBB® Forum Software