Alexander Lohse <email@hidden> wrote:
>public class AppleScriptTest {
>
> private Log _log = LogFactory.getLog(this.getClass());
>
> public AppleScriptTest() {
> StringBuffer sb = new StringBuffer();
> sb.append("tell application \"MacGiro\" \n");
> sb.append(" activate \n");
> sb.append("end tell");
>
You can also do this with the 'osascript' command. All it takes is
exec(String[]). The shell command would be:
osascript -e 'tell application "MacGiro"' -e 'activate' -e 'end tell'
Translating that to an appropriate String[]:
String[] cmd =
{ "osascript", "-e", "tell application \"MacGiro\"",
"-e", "activate", "-e", "end tell" };
One advantage to using the 'osascript' command is that you don't need any
ClassLoader. Another is that you don't have to refer to any of the
com.apple.cocoa.*.NS* classes, either directly or by reflection.
For something as simple as sending some XML to a specific application, it
will probably be simpler and more flexible to use the 'osascript' command.
-- GG
_______________________________________________
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