My app has some raw data content I want to be able to offer to AppleScript so that it can be at least looked at, if not even handled by saving it to a file or setting it to some other object that supports it.
Now, I don't understand which data type is used to accomplish that.
See this output from Script Editor, for instance:
tell application "Script Editor"
the clipboard as record
--> {Unicode text:"text",
«class BBLM»:«data BBLM6C6C756E»,
string:"text"}
end tell
How do I return these «data ...», which are apparently a combination of a 4-char-code and hex-string-encoded bytes of the actual data.
I've tried returning an NSData object containing the raw bytes data from my scriptable property, but that doesn't work.
Update
It appears it has to do with implementing scripting<type>Descriptor
and scripting<type>WithDescriptor
. I cannot find any documentation on this other than it being used in the Sketch sample code. I assume these will be invoked for the type if I happen to define such a custom type in my Sdef.
However: I will not know the types I want to send in advance, so I cannot pre-define them in the Sdef. I'm more in the situation similar to the clipboard
: I have clipboard-like data I want to return, so I only know their 4-char-types at runtime. Which means I won't be asked through these handlers. There must be some other way to generically create and receive these types, the same way the clipboard implementation does it.