advertisement

Article:
  Controlling Your Mac with AppleScript and Java
Subject:   Same error
Date:   2003-06-05 15:28:59
From:   ijames
I am receiving the very same error with the second part of the example. I am very excited to see how this will work. I was sad to see the error even after cutting and pasting the other poster's code for analysis. Any help would be greatly appreciated.


Thanks in advance


import com.apple.cocoa.foundation.*;


public class AppleScriptTest
{
public static void main(String[] args)
{
String script = "tell application \"Finder\" \n"
+ " get the name of the first item "
+ " in the desktop \n" + "end tell";
// This creates a new NSAppleScript
// object to execute the script
NSAppleScript myScript =
new NSAppleScript(script);
// This dictionary holds any errors that are
// encountered during script execution
NSMutableDictionary errors= new NSMutableDictionary();


// Execute the script!
NSAppleEventDescriptor results =
myScript.execute(errors);
String resultString = results.stringValue();
System.out.println("The first item is:"
+ resultString);


System.out.println("Yay AppleSscript!");
}
}