[comp.sys.next] Automatic opening of compressed

phayes@magnus.acs.ohio-state.edu (Patrick W Hayes) (04/22/91)

I wrote this little csh script to open files that end in .Z, not in Edit,
but rather what they would be opened in if they had been uncompressed:

zcat $1 > `basename $1 .Z`
open `basename $1 .Z`
rm `basename $1 .Z`

I call it zopen.  I'm new to csh scripts so I can't say its robust or anything,
but when I type for instance:

zopen Buzz12.ps.Z 

it opens the Buzz12 issue of the NeXT User's Journal automatically in Preview,
and zopen balls.tiff.Z will open balls.tiff in Icon, etc. without keeping the
uncompressed file around after I'm done.  Actually, I guess the uncompressed
version gets removed before I'm done reading it or looking at it or whatever,
but it doesn't seem to matter as (so far anyways) it's been read into a tmp
file upon opening.

So, what I want to know is, can I give a script an icon, and a document icon,
so that I can click on a .Z file from the browser and have it do the same thing
(without writing any code) ?

Or does 2.0 do this for you (I'm still on 1.0.)

Anyone have a better way to do this?

Patrick Hayes

phayes@magnus.ircc.ohio-state.edu (Patrick W Hayes) (04/22/91)

Well, I just found out that there is code out there to do close to what I want.
Reading through the April '90 issue of BuzzNUG (Now the NeXT User's Journal -
a great journal at that may I add) I found out about a program called Unknown,
in which one can add one's own icons, programs, and related suffixes. A .Z
icon is already included, but it is not set up to launch anything as is; for
that you must edit the Unknown.iconinfo file and re-make everything as is
described in the README and in the article "Unix Tools in the Workspace" in
that April '90 issue. (That's issue 5, available on sonata.cc.purdue.edu
in the pub/next/Newsletters/BUZZ directory - I think.)  The program that you
can launch is called Uncompress (note the initial capital letter) which just
parses the command line that was given to it by the workspace manager, and
then calls uncompress.  A version of this Uncompress with a few buttons etc.
is available on sonata as well in the pub/next/sources-1.0 directory, along
with the Unknown source.  But it must be modified to do what I want it to--
launch the uncompressed version automatically and then get rid of the
uncompressed version when I'm done with it.  I tried to get Unknown to launch
a script, but it didn't seem to work.  Really, NeXT should do something about
this; I shouldn't have to recompile Unknown and write an interface C program
every time I want to do something like this (launch a unix document off to a
standard unix utility from the workspace.)  Any ideas?

Patrick Hayes

youki@newmars.ics.osaka-u.ac.jp (Youki Kadobayashi) (04/23/91)

>>>>> On 22 Apr 91 00:15:39 GMT, phayes@magnus.acs.ohio-state.edu (Patrick W Hayes) said:

> So, what I want to know is, can I give a script an icon, and a document icon,
> so that I can click on a .Z file from the browser and have it do the same thing
> (without writing any code) ?

I wrote such application. You can give a csh/bash/perl/mush script an
small window. My first motivation was identical to yours -- "zopen".
I also wanted to print files, unpack ztar archives, edit PS files,
play scorefiles on our MIDI keyboard, etc., without writing any code
for every such a little application.

> Or does 2.0 do this for you (I'm still on 1.0.)

I was informed there are program called /NextDeveloper/Demos/Accepter
but I'm not informed what the program does. Therefore, I don't know
whether or not the 2.0 provides seamless interface between UNIX and
NextStep.

> A version of this Uncompress with a few buttons etc.
> is available on sonata as well in the pub/next/sources-1.0 directory, along
> with the Unknown source.  But it must be modified to do what I want it to--
> launch the uncompressed version automatically and then get rid of the
> uncompressed version when I'm done with it.  I tried to get Unknown to launch
> a script, but it didn't seem to work.  Really, NeXT should do something about
> this; I shouldn't have to recompile Unknown and write an interface C program
> every time I want to do something like this (launch a unix document off to a
> standard unix utility from the workspace.)  Any ideas?

I agree. And I have an idea. I think my program can do this. You can
obtain this program via anon-FTP from:

	site:		cs.orst.edu
	directory:	pub/next/sources
	filename:	SystemWorks.tar.Z
			(contains binary as well as sources)
	caution:	tested only under 1.0

It's freely re-distributable under the GNU General Public License.

Enjoy.
--
Youki Kadobayashi
Dept. of Info. and Comp. Sci, Osaka University, Japan