Launching a web browser from Squeak?

Michael Rueger mike.rueger at
Thu May 11 22:27:47 UTC 2006

John Maloney wrote:
> Does anyone know how to launch a Web browser from within Squeak? I need 
> to be able to pass the URL to the browser to open. It would be really 
> great if I could also tell the browser how big to be and where to open 
> on the screen.
> I realize the solution will probably be highly platform dependent; I'm 
> interesting in solutions for Windows, Macs, and Linux.

For Sophie we just solved that problem :-)
Below is  the windows part, hot of the grill.
The usual disclaimers about exploding CPUs etc apply...





openURIOrPath: uriOrPath

	"Win32Services new openURIOrPath:''"
	"Win32Services new 
	| shellString |
	shellString := uriOrPath , 0 asCharacter.
	^self apiShellExecute: 0 with: 'open' with: shellString with: nil with: 
nil with: 1

apiShellExecute: aWindowHandle with: aCmdString with: target with: para 
with: dir with: flag

"HINSTANCE ShellExecute(
     HWND hwnd,
     LPCTSTR lpOperation,
     LPCTSTR lpFile,
     LPCTSTR lpParameters,
     LPCTSTR lpDirectory,
     INT nShowCmd
	<apicall: long 'ShellExecuteA' (ulong  char* char* char* char* long) 
module: 'shell32.dll'>
	^self externalCallFailed

More information about the Squeak-dev mailing list