#include #include "RunScript.h" #if ! TARGET_API_MAC_CARBON #include #include #include #endif #include size_t _hs_AEDescSize(void) { AEDesc a; return sizeof(a); } // if the input is UTF8Text, returns its size in bytes. Otherwise returns -1 ptrdiff_t _hs_getUTF8Size(const AEDesc* input) { if (input != NULL && input->descriptorType == typeUTF8Text) { return AEGetDescDataSize(input); } else { return -1; } } OSErr _hs_getData(const AEDesc* input, void* dataPtr, size_t maxSize) { AEGetDescData(input, dataPtr, maxSize); } OSErr _hs_dispose(AEDesc* input) { if (input != NULL && input->descriptorType != typeNull) { AEDisposeDesc(input); } } void _hs_initNull(AEDesc * input) { AECreateDesc(typeNull, NULL, 0, input); } /* AppleScriptAvailable returns true if AppleScript is available and the routines defined herein can be called. */ Boolean AppleScriptAvailable(void) { long response; if (Gestalt(gestaltAppleScriptAttr, &response) != noErr) response = 0; return ((response & (1<