panther time out bug (was: panther weirdness)
panther time out bug (was: panther weirdness)
- Subject: panther time out bug (was: panther weirdness)
- From: Seth Tager <email@hidden>
- Date: Thu, 13 May 2004 09:46:50 -0700
Here's an update, and a plea for help. Can someone with os 10.3.3 run this
script (more than once - the first time it should work fine) and let me
know if it waits 2 minutes to finish the second time?
It turns out that after leaving my longer script running during lunch I
returned to find this error, which seems to confirm that there's some
problem with scripts not returning after they are done.
Errors: {
NSAppleScriptErrorBriefMessage = "AppleEvent timed out.";
NSAppleScriptErrorMessage = "FileMaker Pro got an error: AppleEvent
timed out.";
NSAppleScriptErrorNumber = -1712;
NSAppleScriptErrorRange = <00000501 0000001a >;
}
Here are handy java commands to make it easier:
copy text of script to a file named testas.java
to compile:
javac -classpath .:/System/Library/Java testas.java
to run:
java -classpath .:/System/Library/Java testas
Grateful in advance,
Seth
The output should be something like
myScript.executing:
tell application "Finder"
get the name of every item in the desktop
end tell
Elapsed time = 121.149 seconds
Starting list of items on the desktop:
<list of itmes on your desktop>
--On Tuesday, May 11, 2004 1:33 PM -0700 Seth Tager
<email@hidden> wrote:
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.