panther weirdness
panther weirdness
- Subject: panther weirdness
- From: Seth Tager <email@hidden>
- Date: Tue, 11 May 2004 13:33:51 -0700
I recently upgraded to panther and some scripts I ran in the past using
java now hang or take an unusually long time (20 min?) to run.
In attempting to debug, I've figured out that the scripts seem to be
waiting for (2 * timeout) seconds before returning control to java.
Interestingly enough, the script included below runs fast the very first
time I run it after restarting my machine, but after that it always takes 2
minutes to run. (default applescript timeout is 1 minute) If I wrap the
script in 'with timeout of 5 seconds ... end' then the script will finish
in just over 10 seconds.
The main script I'm trying to run involves Filemaker and I think it hangs
completely, but it's possible that it's waiting 2 minutes many, many, times
and so I never see it finish. (I've waited over 1/2 hour).
Any idea of what could be the problem? I'm running os 10.3.3
Seth
import com.apple.cocoa.foundation.*;
import com.apple.cocoa.application.NSApplication;
public class testas
{
public static void main(String[] args)
{
String script = "tell application \"Finder\" \n"
+ " get the name of every item "
+ " in the desktop \n"
+ "end tell\n";
NSApplication.sharedApplication();
// 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!
System.out.println("myScript.executing:");
System.out.println(script);
long start = System.currentTimeMillis();
NSAppleEventDescriptor results =
myScript.execute(errors);
System.out.println("Elapsed time = " +
(System.currentTimeMillis()-start)/1000.0 + " seconds");
// Print out everything on your desktop
System.out.println("Starting list of items "
+ "on the desktop: ");
int numberOfDesktopItems = results.numberOfItems();
for(int i = 1; i <= numberOfDesktopItems; i++)
{
NSAppleEventDescriptor subDescriptor =
results.descriptorAtIndex(i);
System.out.println(" " +
subDescriptor.stringValue());
}
}
}
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.