How to execute code at startup

Lex Spoon lex at cc.gatech.edu
Wed Feb 6 15:35:15 UTC 2002


olmeca at netscape.net (Rudi Angela) wrote:
> Hi,
> I'm trying to use Squeak for creating a game that is supposed to automatically start when the user opens the image. How do I get Squeak to start running my startup code as soon as the image is opened?
> 

There are several possibilities.

First, you may be able to just save your image in an interesting
configuration.  Keep in mind that when the image starts, it starts
*exactly* where it left off.


Second, as a variation, you can save your image like this (do all this
code together):

	Smalltalk snapshot: true andQuit: false.
	self inform: 'Hello, world.'


Third, you can use addToStartUpList: to register any object that
understands startUp:; that object's startUp: method will be invoked
every time the system starts.  (Look in "snapshot and quit" under class
SystemDictionary for details).


-Lex



More information about the Squeak-dev mailing list