Executing Applescript from Java as fast as possible
Executing Applescript from Java as fast as possible
- Subject: Executing Applescript from Java as fast as possible
- From: "Patrick Gerzanics" <email@hidden>
- Date: Wed, 21 Jan 2004 19:33:01 -0600
Hello.
I'm attempting to execute a number of compiled Applescripts from Java, as
fast as is possible. I need it to run on OS X and am currently running OS X
10.2.
So far, I have tried 3 different solutions:
1. Spawning an osascript process for each script that is to be executed.
2. Using the Java-Cocoa NSAppleScript class libraries
3. Using JNI to call native C/Carbon code which uses the Open Scripting
Architecture libraries.
I've found that option #1 works quite well, but is understandably somewhat
slow which I assume is due to the overhead with spawning the subprocess,
etc.
However, for options 2 and 3, I've found that my scripts do not get executed
unless my Java application has the focus, and, don't laugh, I'm moving the
mouse(!). Assuming these things are true, it does seem to take about 1/2 as
long as the spawning method.
Essentially, my application is intended to run in the background and
interact with certain applications on a repetive basis. Spawning osascript
works in the background just fine, but as I've said is somewhat slow.
However, the program stalling every time it loses focus or the user stops
interacting with the desktop is unacceptable for my application.
Is there a 4th solution I'm missing, or a way to prevent options 2 and 3
from acting in such a bizarre manner? Is there a faster way to interact
with applications then Applescript such as an underlying protocol like CORBA
(maybe using Apple Events?)? Is there a better mailing list for this
discussion?
Thanks for any and all assistance!
-Patrick
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.