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: how can an apple script get parameters (when invoking it from the java code)?



I checked, and it's true that osascript params is only 10.4 +

So if summer.scpt is in /tmp ...

String exec = "osascript -e 'run script posix file \"/tmp/summer.scpt\" with parameters {4,5,6}'";

and exec that in your java. like

Runtime.getRuntime().exec(exec);

Clearly, you can substitute the params in that string.


On 21 Oct 2007, at 11:15, email@hidden wrote:

launch your applscript with osascript eg

osascript summer.scpt 4 5 6

now, if your summer.scpt looks like this:

on run args
set sum to 0
repeat with x in args
set sum to sum + x
end repeat
return sum
end run


the output of the script (stdout) is 15

so you'd have to parse the output line to get that value...

caveat: I think that arg passing with osascript came in with 10.4 - it may not work prior to that. In that case, you might want to do a bit of inline osascript use  with -e


On 21 Oct 2007, at 07:42, Itia Gerbi wrote:


Hi all,

How can I pass parameters to an appleScript while invoking it from the
java code, and how can I read their value inside the appleScript?

Thank you all for your advises!

This message and the information contained herein is proprietary and confidential and subject to the Amdocs policy statement,

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

 _______________________________________________
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

References: 
 >Re: how can i know from the java code that an applescript completed to run? - urgent (From: Greg Guerin <email@hidden>)
 >Re: how can i know from the java code that an applescript completed to run? - urgent (From: Yong Hyeon Yoon <email@hidden>)
 >how can an apple script get parameters (when invoking it from the java code)? (From: "Itia Gerbi" <email@hidden>)
 >Re: how can an apple script get parameters (when invoking it from the java code)? (From: 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.