ObjC bindFunction() for Execute AppleScript actions?

The JS Automation object provides ObjC.bindFunction(), which enables us to pull in functions that are not automatically bridged.

Is there something analogous in the AppleScript interface to ObjC which would enable us to pull in trigonometric functions, for example ?

Not needed in JS, which has a Math library, but you can do things like:

(function () {
    'use strict';

       ObjC.bindFunction('cos', ['double', ['double']]);

    return $.cos(5);

   // 0.2836621854632263
})();

Otherwise, of course, KM math calculations include:
SIN, COS, TAN, ASIN, ACOS, ATAN, ATAN2
SINH, COSH, TANH, ASINH, ACOSH, ATANH

You might want to post your question in the Late Night Software (Script Debugger) forum.

Shane Stanley, an ASObjC guru, hangs out there, and will probably address your question.

1 Like