Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: crashing problem due to exception in NSAppleScript



IMD <email@hidden> wrote:

>I have written a method which reads all the records from address book
>on Mac OS X.2  with the help of  NSAppleScript class.

Instead of using NSAppleScript class, I suggest using the 'osascript'
command to run your script.  The output from the script will be sent to
stdout as text, which is read from the InputStream of the Process returned
by exec().

I also recommend using only the String[] variants of exec(), never the
single-String variants.

Two reasons for using exec() instead of NSAppleScript:
  1) it will work under 1.3 or 1.4 on Mac OS X.
  2) it will work on any Java thread.

For more info, read 'man osascript' when running Terminal.  Also see the
Java API docs for the Runtime.exec() methods, and the Process class.

For basic info about how to read the output produced by a Process without
causing deadlock, search the archives for "process" and "deadlock", or
refer to a tutorial:

Sun's Java tutorial:
  <http://java.sun.com/docs/books/tutorial/>

Dick Baldwin's tutorials:
  <http://www.dickbaldwin.com/tutor.htm>

KTH Java Course -- many links on home page:
  <http://www.particle.kth.se/~lindsey/JavaCourse/>


>please respond me as soon as possible.

All the people on this list are unpaid volunteers.  If you want rapid
response with paid Apple support personnel, you should purchase Apple Tech
Support incidents.
  <http://developer.apple.com/technicalsupport/index.html>

  -- 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



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.