How to setup "Open with" Squeak for images (jpeg etc)
Milan Zimmermann
milan.zimmermann at sympatico.ca
Mon Nov 17 00:29:48 UTC 2003
Bert,
Bert,
Thanks again for your suggestion - we now have a way to open graphics from OS
File Manager into squeak! The script worked on the first try (I added . at
the last line).
There is something that is likely a Squak bug or feature: Basically, the only
way for the script to be "sourced" by squeak is if I put it to my
$HOME/dev/smalltalk directory (I have the image and source there) WITHOUT
specifying the full-path-to-script. Any other combination (attempt to specify
path or put the script in another directory) fails.
If anyone uses KDE/Linux this should work (and could be generalized by putting
some environment vars into /etc/profile):
#1: Under KDE File Associations --> JPEG(etc) --> Execute:
cd /home/mzimmermann/dev/smalltalk;squeak
/home/mzimmermann/dev/smalltalk/Squeak3.5-5180.image
./squeak-open-graphics.sq %F
#2: squeak-open-graphics.sq as suggested by Bert:
|stream filename image sketch|
filename := Smalltalk getSystemAttribute: 3.
stream := FileStream readOnlyFileNamed: filename.
[image := Form fromBinaryStream: stream] ensure: [stream close].
sketch := SketchMorph withForm: image.
sketch openInWorld.
Thanks, Milan
On November 15, 2003 11:35 am, Bert Freudenberg wrote:
> Milan Zimmermann wrote:
> > Hi,
> >
> > I'd like to setup my kid's PC (Linux w. KDE) for them to be able to open
> > images with Squeak from the file manager. The idea is that by clicking on
> > a "my-graphics.jpeg" file in the OS File Manager, squeak would start and
> > open the image using the Paint, ideally in a new project. (I guess
> > similarly what "Find + View" would do.)
> >
> > I am not asking about how to define the file type association, rather
> > whether it's possible to execute Squeak with a set of options to start
> > Squeak, run Paint and edit the image, I am thinking something like:
> >
> > # squeak image script-which-opens-paint my-graphics.jpeg
> >
> > Is something like this possible? I guess it would be usefull to have
> > squeak acting as "viewer/editor" for any file types that squeak can
> > handle ..
>
> The script could look like this:
> | stream filename image sketch |
>
> filename := Smalltalk getSystemAttribute: 3.
> stream := FileStream readOnlyFileNamed: filename.
> [image := Form fromBinaryStream: stream] ensure: [stream close].
> sketch := SketchMorph withForm: image.
> sketch openInWorld
>
> and would be called like this:
>
> squeak /full/path/to/my.image /full/path/to/script.st
> /full/path/to/image.jpeg
More information about the Squeak-dev
mailing list
|