When specifying the any
type for a command result in the Sdef, it seems that one cannot simply return the NS types such as NSNumber
. Instead, one needs to return an NSAppleEventDescriptor
.
However, NSAppleEventDescriptor
is rather limited in the values it can handle. There appears to be no support for floating point numbers such as C's double
type.
How do I return double values for the any
type, then?
10.11 has a direct way, a doubleValue
property, for system versions prior to 10.11 you can coerce the descriptor with the method coerceToDescriptorType
to one of these types
typeIEEE32BitFloatingPoint = 'sing',
typeIEEE64BitFloatingPoint = 'doub',
type128BitFloatingPoint = 'ldvl',
For example code see AppleScriptToolKit