From: Alexander Lohse <email@hidden>
>sorry for my last post I already found the answers.
>Here is my code if anyone would like to use it.
>I will publish this on out site soon, as I believe this could be of
>great public interest.
>Maybe some would like to add error-fetching capabilities from the
>NSMutableDictionary?
Your scripts are somewhat odd choices where Runtime could reasonably handle the situation without Cocoa/Java or reflection. Assuming these are simpler examples of the more substantial use you would like to put this to.
My JNIDirect for Cocoa includes some of this so for part of your code I think for mine it would be.
NSApplication.sharedApplication();
No special class loader required. Not toll free of course you do need gcc installed, meaning I think developer tools. The jar though can go classpath on OS X or crossplatform where it can serve as your stubs.
Actually if I remember right it seemed to me the VM about always seemed to have done the NSApplication.sharedApplication() initialization for you, although examples recommend it and it probably doesn't hurt. Could be wrong, been a bit since I looked at some of this.
The rest my GestaltReflection class would make I think...
try { // Some exception thrown on errors
Object dict = GestaltReflection.newInstance("com.apple.cocoa.foundation.NSMutableDictionary",new Object[0]);
GestaltReflection.invoke("com.apple.cocoa.foundation.NSAppleScript",new Object[] { sb.toString() },"execute",new Object[] { dict });
}
catch (Exception ex) { ex.printStackTrace(); }
Some of the invoke methods overloaded to double-duty the contructor invoke as well.
I think my JNIDirect NSAppleScript class includes some handling of the error dictionary but again I haven't looked at it real recently and don't have it readily available now.
Fun stuff though huh?
Mike Hall mikehall at spacestar dot net
http://www.spacestar.net/users/mikehall
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden
This email sent to email@hidden