From: alexxx.magni on
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



From: alexxx.magni on
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...(a)gmail.com" <alexxx.ma...(a)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


From: Armand Tamzarian on
On Mar 18, 4:34 am, "alexxx.ma...(a)gmail.com" <alexxx.ma...(a)gmail.com>
wrote:
> 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...(a)gmail.com" <alexxx.ma...(a)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

You may also be interested in Math Service:

http://library.wolfram.com/infocenter/MathSource/5180/

From: alexxx.magni on
On 20 Mar, 08:46, Armand Tamzarian <mike.honeychu...(a)gmail.com> wrote:
> On Mar 18, 4:34 am, "alexxx.ma...(a)gmail.com" <alexxx.ma...(a)gmail.com>
> wrote:
>
>
>
> > 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...(a)gmail.com" <alexxx.ma...(a)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 Applescrip=
t
> > > editor that Mathematica seems indeed scriptable: opening its
> > > dictionary reveals "Required suite", "Standard suite" and "Mathematic=
a
> > > suite", with names and verbs with which to operate.
> > > Unfortunately, I am completely new to Applescript and dont know how t=
o =
> 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
>
> You may also be interested in Math Service:
>
> http://library.wolfram.com/infocenter/MathSource/5180/

a bit old (revision in 2004) but working perfectly, thank you!
Pity it isnt able to output graphics, I guess my use of Export to PDF
is the only way to do it for now...


alessandro