Is it possible to call “C” style functions from AppleScript?
I’ve recently start using them in my Objective-C code and find them handy sometimes.
Would love to be able to call them from AppleScript.
But my attempts so far have failed.
In one of my Framework Classes:
#pragma mark TAG CHECKED TYPE STATUS
JREnumDeclare(TagCheckedTypeStatus,
Checked_None = 0, // 0
Checked_Whitespace = 1 << 0, // 1
Checked_EpisodeID = 1 << 1, // 2
Checked_CatalogNo = 1 << 2, // 4
Checked_Composer = 1 << 3, // 8
Checked_Label = 1 << 4 // 16
/// TRIMMED
);
NSString* TagCheckTypeStatusInfo(TagCheckedTypeStatus aCheckTagType);
and in the .m
NSString* TagCheckTypeStatusInfo(TagCheckedTypeStatus aCheckTagType) {
NSString* infoHeader = @"CHECK STATUS:";
// TRIMMED
return [infoHeader infoStringByAddingDetails:infoDetails];
}
Trying from AppleScript fails
use AppleScript version "2.4" -- Yosemite (10.10) or later
use framework "Foundation"
use framework "DJKTelHelperUtilities"
use scripting additions
-- classes, constants, and enums used
property TagCheckedTypeStatus : a reference to current application's TagCheckedTypeStatus
property Checked_Whitespace : a reference to 1
property Checked_Label : a reference to 4
property aTagCheckedTypeInfo1 : missing value
property aTagCheckedTypeInfo2 : missing value
set aTagCheckedType to Checked_Label
set aTagCheckedTypeInfo1 to TagCheckTypeStatusInfo(aTagCheckedType)
set aTagCheckedTypeInfo2 to current application's TagCheckTypeStatusInfo(aTagCheckedType)
I guess I could add some non-instance methods on a Class that then call
the C-Functions?