MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: applescript

  • To: mathgroup at smc.vnet.net
  • Subject: [mg108456] Re: applescript
  • From: "alexxx.magni at gmail.com" <alexxx.magni at gmail.com>
  • Date: Thu, 18 Mar 2010 04:33:50 -0500 (EST)
  • References: <hnicpk$st7$1@smc.vnet.net>

it's a pity that nobody seemed interested, but for the sake of future
users googling about this problem, here's what I found:

1) by using this simple script (thanks to Achilleas Lazarides)

tell application "Mathematrica"
  question="FactorInteger[987654321]"
  set x to do script question
  display dialog x
end tell

I get the answer {{3,2},{17,2},{379721,1}}


2) by this instead:

tell application "Mathematica"
  	set s to "Graphics3D[Table[{RGBColor[RandomReal[1, 3]],
Sphere[RandomReal[3, 3], RandomReal[{0.2, 0.4}]]}, {i, 5}], Boxed ->
False]"
	set es to "Export[\"a.pdf\"," & s & "]"
	do script es
end tell

I get a perfect pdf file with the output of any graphic command



alessandro

On 14 Mar, 11:12, "alexxx.ma... at gmail.com" <alexxx.ma... at gmail.com>
wrote:
> hi everybody,
> after using Linux machines since forever, I am now using a macbook,
> and I just discovered what is IMHO the one and only feature where OSX
> leaves Linux (and Win of course ;-) behind: the universal ability to
> make apps communicate one with the other via Applescript.
> (dont flame me: I know I can link Mathematica with C apps and so on...
> the point is just that Applescript is universal & painless to use...)
>
> Anyway: I just installed Mathematica, and found out in the Applescript
> editor that Mathematica seems indeed scriptable: opening its
> dictionary reveals "Required suite", "Standard suite" and "Mathematica
> suite", with names and verbs with which to operate.
> Unfortunately, I am completely new to Applescript and dont know how to begin.
> Googling around I discovered MathLink for Applescript
> (www.unisoftwareplus.com/products/mathlinkosax/), but it seems an old
> product, and moreover I'd like to communicate with Math without
> installing anything else.
>
> So I just want to ask if any of you has experience on scripting
> Mathematica from the outside!
>
> thanks...
>
> alessandro



  • Prev by Date: Re: Bug in NMinimize?
  • Next by Date: Re: Styling print output
  • Previous by thread: applescript
  • Next by thread: Re: applescript