[squeak-dev] Execute on Launch?

David T. Lewis lewis at mail.msen.com
Sun Sep 7 15:09:13 UTC 2008


On Sun, Sep 07, 2008 at 10:41:59AM -0400, Jim Rosenberg wrote:
> How do I get a method in one of my own classes to fire when Squeak first 
> launches?

Step one:
On the class side of your class, implement #startup: and have
your #startup: method do whatever needs to be done on image startup.
The parameter to the #startup: method will indicate whether the
image is being restarted (versus resuming after an image save), so
test for this (resuming ifTrue: [do my startup stuff]).

Step two:
In a #initialize class method for your class, add the line:
	Smalltalk addToStartUpList: self.
Evaluate this one time to add your class to the system startup
list. This causes your #startup: method to be called whenever
the image is restarted.

Step three:
Save your image, restart, and see if it works.

Dave




More information about the Squeak-dev mailing list