[Newbies] Processing a file at image startup (scripting)
cdrick65 at gmail.com
Tue May 19 17:37:02 UTC 2009
While delivering a small app (a project scheduler), people asked me if
it's possible to execute it by a command line without opening an
image. I have a pseudo-dsl to define a project (collection of tasks)
that the app is scheduling and so, what I'd like is launching the app
by passing a file as parameter. Then squeak "open headless", process
the entry file, write an outputfile with results and eventually
errors, and exit.
I did something but this is a terrible hack :) I'd like to have other
idea on that. If we consider:
squeak -headless test.image file.in
According to the vm man, file.in must be a script (st file with bang
notation). I'm not aware of a way to pass a plain text file. So I just
hacked ProjectLauncher>>startUpAfterLogin (this is where I get a dnu
if passing a file as parameter) so that my file can be processed and
the image closed afterwhile.
Can people point me a better way of doing that ? My feeling is I need
to create a ScriptClass that has a startUp method where file
processing can be implemented.
ps: a related question would be which startUp classes are not
necessary if we only need to process a File (do we need InputSensor,
More information about the Beginners