• 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
Re: Any Joy with Santimage OXEN
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Any Joy with Santimage OXEN


  • Subject: Re: Any Joy with Santimage OXEN
  • From: Shane Stanley <email@hidden>
  • Date: Tue, 23 Oct 2018 14:28:37 +1100

On 23 Oct 2018, at 7:08 am, Deivy Petrescu <email@hidden> wrote:
>
> But, your test is fine for computing one value of function.
> With Smile (Satimage OSAX) you could compute an array of values
> simultaneously (evalformula).

Takaaki's library is using AppleScriptObjC to call JavaScriptCore, which is
just an Objective-C wrapper around WebKit's Javascript. In other words, a very
fast way to call Javascript from AppleScript.

So, for example:

use AppleScript version "2.4" -- Yosemite (10.10) or later
use framework "Foundation"
use framework "JavaScriptCore"
use scripting additions
property theContext : missing value

set mapFunction to myContext()'s objectForKeyedSubscript:"mapFunction"
set cosFunction to myContext()'s objectForKeyedSubscript:"doCos"
set theResult to (mapFunction's callWithArguments:{{1, 2, 3, 4, 5},
cosFunction})'s toArray() as list

on myContext()
        if theContext = missing value then
                -- set up js engine and load functions
                set theContext to current application's JSContext's new()
                theContext's evaluateScript:("
function doCos(a) {
    return Math.cos(a);
}
function mapFunction(a, b) {
    return a.map(b);
}")
        end if
        return theContext
end myContext

The point is not which is better, but rather that there is a readily available,
if more complex, replacement for many of the Satimage commands, and it's pretty
fast.

--
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

  • Follow-Ups:
    • Re: Any Joy with Santimage OXEN
      • From: Deivy Petrescu <email@hidden>
References: 
 >Any Joy with Santimage OXEN (From: WalterStuartBushell <email@hidden>)
 >Re: Any Joy with Santimage OXEN (From: Deivy Petrescu <email@hidden>)
 >Re: Any Joy with Santimage OXEN (From: Shane Stanley <email@hidden>)
 >Re: Any Joy with Santimage OXEN (From: Deivy Petrescu <email@hidden>)

  • Prev by Date: Re: Any Joy with Santimage OXEN
  • Next by Date: Re: Any Joy with Santimage OXEN
  • Previous by thread: Re: Any Joy with Santimage OXEN
  • Next by thread: Re: Any Joy with Santimage OXEN
  • Index(es):
    • Date
    • Thread