• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
String data from SE to Terminal/Mathematica
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

String data from SE to Terminal/Mathematica


  • Subject: String data from SE to Terminal/Mathematica
  • From: Philippe GRUCHET <email@hidden>
  • Date: Fri, 4 Apr 2003 04:39:05 +0200

Greetings!

(Mach-O 10.2.4)

I'm looking for the 'best ' way to pass string data from an AppleScript script to a shell in the Terminal.
The goal is to control the Mathematica's "MathKernel" itself.

--------------------------------------
1) To initialize the MathKernel, just need to put its Posix path in Terminal:


'username'% /Applications/Mathematica4.2.app/Contents/MacOS/MathKernel

Mathematica 4.2 for Mac OS X
Copyright 1988-2002 Wolfram Research, Inc.
-- Terminal graphics initialized --

In[1]:=
--------------------------------------

2) Ditto, but from an AppleScript script:

tell application "Terminal"
activate
delay 2
do script "
/Applications/Mathematica4.2.app/Contents/MacOS/MathKernel
Exit[]
"
end tell
--------------------------------------
Exit[] --> quit MathKernel in Terminal
--------------------------------------


3) In Mac OS 9, I just needed to do something like:

tell app "MathKernel" to DoScript "9^-27"

=>

In[1]:= 9^-27
1
Out[1]= -----------------------------------------
58149737003040059690390169

--------------------------------------


4) When I send a 'do script' command to do that in the Terminal:

--------------------------------------
set aChain to "
/Applications/Mathematica4.2.app/Contents/MacOS/MathKernel
3*3
9^-27
Eigenvalues[{{1, 2, 3}, {4, 5, 6}, {7, 8, 9}}]
Exit[]
"

tell application "Terminal" to do script aChain
--------------------------------------

This works fine except that all predefined "Inputs" in 'aChain' are not printed (displayed) in the Terminal shell window, only results (Outputs):

In[1]:=
Out[1]= 9


In[2]:=
1
Out[2]= ----------------------------------------
58149737003040059690390169

In[3]:=
Out[3]:= {0, (3/2)*(5 - Sqrt[33]), (3/2)*(5 + Sqrt[33])}


Is there somebody who knows a better procedure?
If yes, thank you very much in advance to share it!



Kind regards,
Philippe/SVM Mac
_______________________________________________
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.

  • Prev by Date: Space in POSIX path
  • Next by Date: Re: Space in POSIX path
  • Previous by thread: Re: Space in POSIX path
  • Next by thread: GUI Scripting in AS Studio
  • Index(es):
    • Date
    • Thread