[Helma-user] Invisible steamroller! Applescript+Helma

Stefan Rinner rist at mac.com
Wed Nov 21 21:07:14 CET 2007


Hi

I investigated the combination of Helma and Applescript some time ago   
- here are some parts from my notes - this stuff worked back then, but  
I have no idea if it still works in Leopard

first you need to package the Applescript class files into a jar:

cd /System/Library/Java
jar -cvf ~/com.apple.cocoa.jar com/apple/cocoa/*

put the com.apple.cocoa.jar into your lib/ext

to execute a piece of Applescript use this in your helm app:

function callAppleScript( scriptSource ) {
	var cocoaFoundation = Packages.com.apple.cocoa.foundation;
	var appleScript = new cocoaFoundation.NSAppleScript( scriptSource );
	var errors = new cocoaFoundation.NSMutableDictionary();
	var result = appleScript.execute( errors );

	if(errors.count() != 0)
		throw( "AppleScriptException" );
	return result;
}

- stefan


More information about the Helma-user mailing list