[Cuis-dev] How to run code on every startup?

Juan Vuletich JuanVuletich at zoho.com
Sun Nov 19 09:13:45 CST 2017

Hi Javier,

On 11/19/2017 3:26 AM, Javier Olaechea via Cuis-dev wrote:
> Hi,
>   I've been trying to adapt Cuis so that it checks and execute a 
> .cuisrc file if it finds one (like any other .rc file). I want to load 
> some code on every startup (my preferences, and install some packages) 
> w/o saving a new image so I don't have to repeat the process every 
> time I update Cuis.
> I've been able to determine that the SystemDictionary initialize 
> method builds up a startupList, but adding items to it doesn't seem to 
> achieve my desired goal. I also haven't been able to find out, when 
> and where Smalltalk gets initialized to an instance of the 
> SystemDictionary. Any pointers? How do our users of Cuis handle 
> customizing up their environment?
> Thanks in advance,
>   Javier Olaechea
> -- 
> "I object to doing things that computers can do." — Olin Shivers

My preferred way to do this is to add command line parameters to the 
command that starts Cuis. This way works with the stock image. For 
example, this is the build script for one of the Cuis based commandline 
applications I wrote for my job:

cogspur/squeak -vm-display-null Cuis-Smalltalk-Dev/Cuis5.0-3207.image -r 
Cuis-Smalltalk-Dev/Packages/LinearAlgebra.pck.st -r 
payload/Packages/Satellogic-Payloads.pck.st -d"FrameRectificationApp 

This loads (requires, -r) two packages and executes (doit, -d) a 
Smalltalk expression. It uses AppLauncher to start the application 
specific code when the app is run, for example like this:

cogspur/squeak -vm-display-null payload/FrameRectification.image 
input_path output_path config_file

Take a look at #processCommandLineArgument:storeStartUpScriptArgsOn: 
This mechanism can also run smalltalk scripts in .st files.  Also see 
#processCommandLineArguments if you want to implement a specific way, 
although I think what we already have is good enough, and would like to 
enhance it if it doesn't suit your needs.


Juan Vuletich

More information about the Cuis-dev mailing list