• 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: Deivy Petrescu <email@hidden>
  • Date: Tue, 23 Oct 2018 09:07:34 -0400


> On Oct 22, 2018, at 23:28 , Shane Stanley <email@hidden> wrote:
>
> 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>


Shane, no discussion there, I am just sad to see Smile and its osaxen depart
from the OS.
In any case, because of also how Apple has been treating AS I have been mostly
using my past scripts.
Then using PHP and JS for web stuff (Python for interesting stuff ing general).
However, your example above is beautiful.
I should start using more ASOC.
I do have a question, I do see a point and at the same time I don’t on the line

return a.map(b)

Is this map() a keyword? I understand it to wrap the function call for a, but
at the same time I dont understand why not   a(b)?



Deivy Petrescu
email@hidden



 _______________________________________________
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: Shane Stanley <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>)
 >Re: Any Joy with Santimage OXEN (From: Shane Stanley <email@hidden>)

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