Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How do I associate an app with a file type?

5 views
Skip to first unread message

Jon Wright

unread,
Feb 18, 1997, 3:00:00 AM2/18/97
to

I have an OPENSTEP 4.1 question.

How do I associate an OPENSTEP application with a particular file type?
I know how to use the Tools Inspector to show which apps OPENSTEP thinks
can open the particular file type and to set the default application for
that file type, but what if an application doesn't show up in the list the
Tools Inspector displays? Is there any way to force the application to be
"discovered" by the Tools Inspector?

Specifically, I am running some FAX software that generates TIFF files.
However, it calls them <blahblahblah>.tif. The only apps that the Tools
Inspector claims can open a .tif file are IconBuilder, Edit, and WM.
If I rename the file to be <blahblahblah>.tiff, then Preview shows up
in the list of applications.

I can manually open the .tif file in Preview, but I'd like to set Preview
as the default application for .tif files. Any suggestions?

Thank you for any help,
Jon
--
-------------------------------------------------------------------
Jon Wright jwr...@blarg.net voice 206-635-0338
fax 206-635-0339
I'm a potato and I'm so hip http://www.blarg.net/~jwright

Jim Sowers

unread,
Feb 19, 1997, 3:00:00 AM2/19/97
to

In article <5ee6e7$5...@animal.blarg.net> jwr...@animal.blarg.net (Jon
Wright) writes:
> I have an OPENSTEP 4.1 question.
>
> How do I associate an OPENSTEP application with a particular file type?
> I know how to use the Tools Inspector to show which apps OPENSTEP thinks
> can open the particular file type and to set the default application for
> that file type, but what if an application doesn't show up in the list
the
> Tools Inspector displays? Is there any way to force the application to
be
> "discovered" by the Tools Inspector?
>
> Specifically, I am running some FAX software that generates TIFF files.
> However, it calls them <blahblahblah>.tif. The only apps that the Tools
> Inspector claims can open a .tif file are IconBuilder, Edit, and WM.
> If I rename the file to be <blahblahblah>.tiff, then Preview shows up
> in the list of applications.
>
> I can manually open the .tif file in Preview, but I'd like to set
Preview
> as the default application for .tif files. Any suggestions?
>

You cannot (if you do not have the source code). If an application does
not support a filetype (a particular extension) you cannot change it,
since it is the app that sets which extension it will support. You may
want to see if your fax software will generate the .tiff extension instead
of the .tif extension. Or you can change it yourself (or write a shell
script). Or you can complain to the app's creator(s).

--
Jim Sowers - NeXT Technical Support

Art Isbell

unread,
Feb 20, 1997, 3:00:00 AM2/20/97
to

Hmmm, seems like segedit allows the Mach-O section that specifies the
file extensions, associated icons, etc. to be extracted from the executable
to produce a file that's identical to the *.iconheader file that's part of
the source. Then edit the file to add a new file extension and associated
icon. segedit then allows this modified iconheader file to be loaded back
into the executable.

But maybe I'm just dreaming about being able to do this... :-)
--
Art Isbell NeXT/MIME Mail: ais...@ix.netcom.com
Trego Systems Voice/Fax: +1 408 335 2515
OPENSTEP/NT Voice Mail: +1 408 335 1154
managed care solutions US Mail: Felton, CA 95018-9442

Timothy J Luoma

unread,
Feb 20, 1997, 3:00:00 AM2/20/97
to comp-sys-ne...@antigone.com, jwr...@animal.blarg.net

Responding To: jso...@next.com (Jim Sowers)
Original Date: 19 Feb 1997 20:50:52 GMT

> You cannot (if you do not have the source code). If an application
> does not support a filetype (a particular extension) you cannot
> change it, since it is the app that sets which extension it will
> support.

No no no! That's entirely not true. In fact, I made a version of
Preview.app that opens .tif files in 5 minutes.

Use SegHoarker
ftp://ftp.next.peak.org/pub/next/apps/devtools/SegHoarker.1.0.0.NIHS.b.tar.gz

Make a copy of Preview.app. Open ("Hoark") the _COPY_ of Preview
within Preview.app and open __ICON and then __header. You will get
a file opened in Edit.app that looks like this:

F Preview.app Preview app
F Preview Preview app
S ps Preview ps
S tiff Preview
S eps Preview

Copy the "S tiff Preview" line and change it to:
S tif Preview

Save the Edit.app file. Goto SegHoarker and click on "Replace"
(while still selected on __ICON and __header). Save the new copy as
"Preview". Move the file "Preview" inside the COPY of
"Preview.app" that you started from. Then you need to move the new
Preview.app to somewhere like /LocalApps and then renamed the
original Preview.app to something like Preview.app.offline (which
will take it off the registered list of apps).

Lastly, run "Update Viewers" from Workspace manager, which will
update the app registry list so your version of Preview.app will
come up for files which end in "tif".

This may not work for all apps, but it certainly works for
Preview.app. It's one of the reasons I love NeXTStep, this type of
customization. Garrick Toubassi (formerly of NeXT) made the source
code for SegHoarker available to us.

If I haven't made this process clear, please let me know. It's
really easy to do but harder to describe.

TjL

--
Tj Luoma (luo...@peak.org)
If you have a web page about NeXTStep|OpenStep, email me the URL!

EMAIL ADDRESS: Please use the PEAK address and not the NERC one

Stefano Pagiola

unread,
Feb 21, 1997, 3:00:00 AM2/21/97
to

Timothy J Luoma wrote:
> > You cannot (if you do not have the source code). If an application
> > does not support a filetype (a particular extension) you cannot
> > change it, since it is the app that sets which extension it will
> > support.
>
> No no no! That's entirely not true. In fact, I made a version of
> Preview.app that opens .tif files in 5 minutes.
>
> [instructions deleted]

>
> This may not work for all apps, but it certainly works for
> Preview.app. It's one of the reasons I love NeXTStep, this type of
> customization.

Yes, it can be done, but wouldn't it be nice if there was a generalized,
GUI way to do this? Something you could manipulate through a workspace
inspector, for example? It seems to me that this should be easy to
implement.

---
Stefano Pagiola
850 N Randolph Str No.817, Arlington VA 22203, USA
All opinions are my own and do not necessarily reflect
those of my employer

Garance A Drosehn

unread,
Feb 21, 1997, 3:00:00 AM2/21/97
to

jwr...@animal.blarg.net (Jon Wright) wrote:
> Specifically, I am running some FAX software that generates TIFF
> files. However, it calls them <blahblahblah>.tif. The only apps
> that the Tools Inspector claims can open a .tif file are IconBuilder,
> Edit, and WM. If I rename the file to be <blahblahblah>.tiff,
> then Preview shows up in the list of applications.
>
> I can manually open the .tif file in Preview, but I'd like to
> set Preview as the default application for .tif files. Any
> suggestions?

Hmm. You might be able to get Opener.app to do this, except
that I think you'd have to compile Opener.app to do that. My
guess is that the current version of Opener is based on the
older version of NeXTSTEP, and it would require some work to
compile it (at all) under OpenStep 4.x.

---
Garance Alistair Drosehn = g...@eclipse.its.rpi.edu
Senior Systems Programmer (MIME & NeXTmail capable)
Rensselaer Polytechnic Institute; Troy NY USA

Holger Hoffstaette

unread,
Feb 25, 1997, 3:00:00 AM2/25/97
to

Jon Wright wrote:
> How do I associate an OPENSTEP application with a particular file type?

You can't - not without pulling a hack, that is.
See below.

> I know how to use the Tools Inspector to show which apps OPENSTEP thinks
> can open the particular file type and to set the default application for
> that file type, but what if an application doesn't show up in the list the
> Tools Inspector displays? Is there any way to force the application to be
> "discovered" by the Tools Inspector?

Yes.
The application in question has to register itself for the partiular
file type; if it doesn't do that, WM won't allow you to select it.

> (snip)


> I can manually open the .tif file in Preview, but I'd like to set Preview
> as the default application for .tif files. Any suggestions?

--snip--

>From: iz...@pinoko.berkeley.edu (Izumi Ohzawa)
>Newsgroups: comp.sys.next.software
>Subject: Re: Preview as default opener for .tif files?

In article <1994Oct12....@nbivax.nbi.dk> sa...@nbivax.nbi.dk writes:

>Preview is the default opener for .ps and .tiff files. Is it possible
>to make it the default opener for .tif tiles too? (I'm creating the
>files under msdos and would like to keep the same names.)

Edit __header section of __ICON Mach-O segment in executable
/NextApps/Preview.app/Preview.
Extract __header using segedit, edit it to add a line for "tif"
and put it back using segedit again.
See "man segedit" or just type the command without args.
It should be obvious what to do from the following.

% segedit Preview -extract __ICON __header ~/header
% cat ~/header


F Preview.app Preview app
F Preview Preview app
S ps Preview ps
S tiff Preview
S eps Preview

@

--
Izumi Ohzawa <iz...@pinoko.berkeley.edu> [ 大澤五住 ]
USMail: Univ. of California, 360 Minor Hall, Berkeley, CA 94720-2020
Tel: 510-642-6440, Fax: 510-642-3323, (NeXT & MIME mails welcome)

--snip--

This also works fine for any other file type, for example JPEGs or GIFs
if you have an appropriate filter installed. No more n+1 custom
picture viewers for different file types..

Holger
--
hh...@schwaben.de.NOSPAM LOAD "MACH_KERNEL",8,1


Denise Howard

unread,
Feb 25, 1997, 3:00:00 AM2/25/97
to

Garance A Drosehn (g...@eclipse.its.rpi.edu) wrote:
: Hmm. You might be able to get Opener.app to do this, except

: that I think you'd have to compile Opener.app to do that.

Correct on both counts. Opener has already been modified to do something
very similar--it takes care of .TIFF and .EPS files (note the
capitalization). All it does is change the suffixes to .tiff/.eps and
message Preview to take the files from there.

: My guess is that the current version of Opener is based on the


: older version of NeXTSTEP, and it would require some work to
: compile it (at all) under OpenStep 4.x.

Correct again. The current version was built quad-fat under NS 3.3.

In my spare time here and there I am working on completely rewriting
Opener so that it can be more easily OpenStep-ified. But don't look for
the announcement anytime soon, since my real job is keeping me plenty
busy....

Denise
--
Denise Howard | PROGRAM, tr. v., An activity similar to
Mountain View, CA | banging one's head against a wall, but
den...@best.com | with fewer opportunities for reward.
NeXTMail welcome! | http://www.best.com/~deniseh

Don Yacktman

unread,
Feb 27, 1997, 3:00:00 AM2/27/97
to

jso...@next.com (Jim Sowers) wrote:
> In article <5ee6e7$5...@animal.blarg.net> jwr...@animal.blarg.net (Jon
> Wright) writes:
> > I have an OPENSTEP 4.1 question.
> >
> > How do I associate an OPENSTEP application with a particular file type?
>
> You cannot (if you do not have the source code). If an application does
> not support a filetype (a particular extension) you cannot change it,
> since it is the app that sets which extension it will support. You may
> want to see if your fax software will generate the .tiff extension instead
> of the .tif extension. Or you can change it yourself (or write a shell
> script). Or you can complain to the app's creator(s).

That's not quite right, at least on Mach. The app's executable under Mach is
a Mach-O file. You can use otool to extract the file which contains info
about supported file types (<appname>.iconheader), modify it, and then use
otool to reassemble the binary with the new iconheader. But you pretty much
need to be an "expert" to do this without screwing up the app, so be careful!

This won't change the extensions used to write the file, however. It only
changes what extensions the WorkSpace thinks the app will open up (and the
icon to go with it). And again, it is not for the faint of heart...

--
Later,

-Don Yacktman
d...@misckit.com
<a href="http://www.misckit.com/don.html">My home page</a>


0 new messages