SCOUG-Programming Mailing List Archives
Return to [ 18 |
September |
1998 ]
<< Previous Message <<
>> Next Message >>
Content Type: text/plain
-----BEGIN PGP SIGNED MESSAGE-----
On Fri, 18 Sep 1998 11:37:29 PDT, Steven Levine wrote:
>In <199809181611.JAA21845@smtp.well.com>, on 09/18/98
> at 09:09 AM, "Gregory W. Smith" said:
>
>> /* This only works by magic. Use at your own risk */
>
>Magic is relative. You might want to post the code. I've never needed to
>do this, so I'd have to fiddle to develop something that really worked.
Briefly, what I want to do is change the default associations for my
.gif, .jpg, and .bmp files so that double clicking on them opens
PMView. Right now it starts the default OS/2 image viewer.
The magic I ran across is this procedure from the install script
for EMACS. This procedure changes the default association
so that EMACS opens as the default editor instead of E.EXE.
/* ---------------------------------------------------------------------- */
Makedefault: procedure expose key. assoc.
/* WARNING: This procedure changes Workplace Shell associations in an
undocumented way by directly manipulating OS2.INI.
This only works by magic.
Use at your own risk. */
ECHandleBin="ERROR:"
do i=1 to 10 until ECHandleBin \== "ERROR:"
/* Find the object handle of Emacsclient */
ECHandleBin=SysIni(, "PM_Workplace:Location", "")
if ECHandleBin=="ERROR:" then
do
say "Waiting for the Workplace Shell. Stay tuned..."
call SysSleep i
end
end
if ECHandleBin=="ERROR:" then
do
say "*** Can't determine object handle for "
exit
end
/* convert to 0-terminated decimal string */
ECHandle=c2d(reverse(ECHandleBin)) || "00"x
do i=1 to key.0
AssocHandles=GetIni(key.i, assoc.i)
ECPos=pos(ECHandle, AssocHandles)
if ECPos=0 then
do
say "*** Can't find association of "assoc.i" with Emacsclient."
exit
end
NewHandles=ECHandle||left(AssocHandles,ECPos-1)||,
substr(AssocHandles, ECPos+Length(ECHandle))
if SysIni(, key.i, assoc.i, NewHandles)="ERROR:" then
do
say "*** Can't store new value for "key.i","assoc.i" in OS2.INI"
exit
end
end
return 1
===============================================================
Gregory W. Smith (WD9GAY) gsmith@well.com
finger gsmith@well.com for PGP public key
-----BEGIN PGP SIGNATURE-----
Version: 2.6.2
iQCVAwUBNgLJ4DtML4mvizAhAQFMwwP+MeYkd97dbQOzG5Ms5aI8RxKsD1C2lJKh
2iQbhJCRdMO+Ge9R36M/xqsJm/170eQkPu7yCizs9frUXBps04zcnIRO/CEUPRZB
Y0sET7RTkzCx61dUShC5eAxst/F6q894zZ693xDbPGXzJ6t8F7MNx+QTw1R3+iZw
N1OkMw2JLik=
=ARo1
-----END PGP SIGNATURE-----
=====================================================
To unsubscribe from this list, send an email message
to "steward@scoug.com". In the body of the message,
put the command "unsubscribe scoug-programming".
For problems, contact the list owner at
"rollin@scoug.com".
=====================================================
<< Previous Message <<
>> Next Message >>
Return to [ 18 |
September |
1998 ]
The Southern California OS/2 User Group
P.O. Box 26904
Santa Ana, CA 92799-6904, USA
Copyright 2001 the Southern California OS/2 User Group. ALL RIGHTS
RESERVED.
SCOUG, Warp Expo West, and Warpfest are trademarks of the Southern California OS/2 User Group.
OS/2, Workplace Shell, and IBM are registered trademarks of International
Business Machines Corporation.
All other trademarks remain the property of their respective owners.
|