home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 18 REXX
/
18-REXX.zip
/
ASSOCT.ZIP
/
ASSOCT.CMD
Wrap
OS/2 REXX Batch file
|
1993-01-04
|
4KB
|
126 lines
/*****************************************************************************
* *
* Define/delete an association type *
* *
*****************************************************************************/
'@echo off'
say ' '
parse arg AssocType
AT = translate(AssocType)
PMAssocApp = 'PMWP_ASSOC_TYPE'
/* Register the REXXUTIL functions */
Call RxFuncAdd 'SysLoadFuncs', 'REXXUTIL', 'SYSLOADFUNCS'
rc=SysLoadFuncs()
k = pos('/L',AT) ; if k<>0 then signal ListAssoc
k = pos('/D',AT) ; if k<>0 then signal DeleteAssoc
signal DefineAssoc
/*****************************************************************************/
ListAssoc: /* List all defined types */
say 'Listing all association types'
say ' '
/* Get the list */
Call SysIni 'USER', PMAssocApp, 'ALL:', 'Assoc'
If Assoc.0<2 then return
/* See if we have anything */
If Assoc.0=0 then do
say 'No association types currently defined'
say ' '
exit
end
say Assoc.0 'association types defined'
say ' '
/* Sort the list */
do i = 1 to Assoc.0-1
do j=i+1 to Assoc.0
if Assoc.i > Assoc.j then do
Temp = Assoc.i ; Assoc.i = Assoc.j ; Assoc.j = Temp
end
end
end
/* Print the list out */
say 'Currently defined types:'
k = trunc(Assoc.0 / 2)
kd = k ; if k*2<>Assoc.0 then kd = kd + 1
do i=1 to k
k1 = i + kd
say left(Assoc.i,39) Assoc.k1
End
k1 = Assoc.0
if k*2 <> k1 then say Assoc.kd
say ' '
exit
/*****************************************************************************/
DefineAssoc: /* Define an association type */
AssocType = strip(AssocType)
say 'Defining association type:' AssocType
say ' '
rc=SysIni('USER', PMAssocApp, AssocType, ' ')
Msg = 'Type "'AssocType'" defined'
if left(rc,6)='ERROR:' then Msg = 'Error return from define'
say Msg
say ' '
exit
/*****************************************************************************/
DeleteAssoc: /* Delete an association type */
if k=1 then AssocType = substr(AssocType,3)
else AssocType = substr(AssocType,1,k-1)
AssocType = strip(AssocType)
say 'Deleting association type:' AssocType
say ' '
rc=SysIni('USER', PMAssocApp, AssocType,'DELETE:')
Msg = 'Type "'AssocType'" deleted'
If LEFT(rc,6)='ERROR:' Then Msg = 'Error during delete or not defined'
say Msg
say ' '
exit
/*****************************************************************************/
/*
ASSOCTYPE
An OS/2 Association Type Maintenance Routine
ASSOCTYP.CMD is a REXX command that allows you to create your own
association types. For instance, I have created a special type for
my favorite word processor and my financial planning application. By
doing this, I can ensure that the program that will process these files
will start when I select the files regardless of the name that I may assign
to the files. This extends the set of associtions shipped with OS/2 and
allows you to customize to your liking.
The syntax of the command is simple -- there are three supported functions:
Create an association type: ASSOCTYPE type name text
Delete an association type: ASSOCTYPE type name text /D
List current association types: ASSOCTYPE /L
(Note: The /D and /L above can be upper or lower case and the /D can come
either first or last in the string.)
This CMD uses the SYSINI function of the REXXUTIL package which is shipped
with OS/2 so no special other software is required.
First uploaded: 1/2/93
*/