Re: Any Joy with Santimage OXEN
Re: Any Joy with Santimage OXEN
- Subject: Re: Any Joy with Santimage OXEN
- From: Shane Stanley <email@hidden>
- Date: Sun, 21 Oct 2018 10:46:43 +1100
On 21 Oct 2018, at 10:24 am, WalterStuartBushell <email@hidden> wrote:
>
> Or can anyone tell me how to do numerical calculations with trig functions,
> exponentials and other transcendental functions?
I presume you mean under Mojave. You can use this app by Mark Alldritt to run
your code largely unchanged:
<https://forum.latenightsw.com/t/use-satimage-scripting-additions-on-mojave/1576>
You can also use ASObjC to call JavaScriptCore. For example:
use AppleScript version "2.4" -- Yosemite (10.10) or later
use framework "Foundation"
use framework "JavaScriptCore"
use scripting additions
set x to pi -- whatever
set theContext to current application's JSContext's new()
set cosX to (theContext's evaluateScript:("Math.cos(" & x & ")"))'s toDouble()
Or more efficiently if you are calling it multiple times:
use AppleScript version "2.4" -- Yosemite (10.10) or later
use framework "Foundation"
use framework "JavaScriptCore"
use scripting additions
property theContext : missing value
set x to pi -- whatever
set cosX to (myContext()'s evaluateScript:("Math.cos(" & x & ")"))'s toDouble()
on myContext()
if theContext = missing value then set theContext to current
application's JSContext's new()
return theContext
end myContext
--
Shane Stanley <email@hidden>
<www.macosxautomation.com/applescript/apps/>, <latenightsw.com>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden