Re: panther weirdness
Re: panther weirdness
- Subject: Re: panther weirdness
- From: Seth Tager <email@hidden>
- Date: Fri, 14 May 2004 09:41:44 -0700
Hmm. Interesting thought. The problem here is definitely with Applescript,
though you're right that it may have to do with the java interface to
applescript so I'll go ahead and post it there too.
Thanks,
Seth
--On Thursday, May 13, 2004 3:08 PM -0400 Graff <email@hidden> wrote:
You have the wrong list. This list is for AppleScript, not Java. You
probably want to post this on the Java-dev list:
<http://www.lists.apple.com/mailman/listinfo/java-dev>
- Ken
On May 11, 2004, at 4:33 PM, Seth Tager 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.
_______________________________________________
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.