How to execute a script file with arguments

Lex Spoon lex at cc.gatech.edu
Fri May 31 13:38:00 UTC 2002


"=?iso-8859-1?q?German=20S.=20Arduino?=" <garduino at yahoo.com> wrote:
> Hello:
> 
> I know that I can call Squeak, by example as:
> 
> squeak image script.st arg1 arg2 arg3
> 
> Supposing that arg1 arg2 and arg3 are receiver,
> subject and data to build a mail that I want to send
> with SMTPSocket, how I must build de script to read
> these arguments and next send the mail?.

This is actually a FAQ (http://minnow.cc.gatech.edu/squeak/425).  Here's
the page, which is admittedly a tad sparse:

================
A Squeak script file can be executed as follows.

If you run "Squeak myImage.image script.st arg1 arg2 arg3", then script.st will be filed in as the image starts up. 

arg1, arg2, and so on may be accessed with SystemDictionary>>getSystemAttribute:. The argument to getSystemAttribute: is an integer which determines what is returned:
0 - Virtual Machine name
1 - Image name
2 - Script file name
3 ... n - additional arguments

See System Attributes for fuller details.
================


Also, check out the more general page on strategies for making Squeak programs that can be run from your OS's facilities; there are other ways than script files:

	http://minnow.cc.gatech.edu/squeak/2269


-Lex



More information about the Squeak-dev mailing list