static PyObject * PyOSA_GetAppTerminology(PyObject* self, PyObject* args) { AEDesc theDesc = {0,0}; FSSpec fss; ComponentInstance defaultComponent = NULL; SInt16 defaultTerminology = 0; Boolean didLaunch = 0; OSAError err; REALLYLONG modeFlags = 0; if (!PyArg_ParseTuple(args, "O&|i", PyMac_GetFSSpec, &fss, &modeFlags)) return NULL; /* ** Note that we have to use the AppleScript component here. Who knows why ** OSAGetAppTerminology should require a scripting component in the ** first place, but it does. Note: doesn't work with the generic scripting ** component, which is unfortunate as the AS component is currently very ** slow (~1 sec?) to load, but we just have to live with this. */ defaultComponent = OpenDefaultComponent (kOSAComponentType, 'ascr'); err = GetComponentInstanceError (defaultComponent); if (err) return PyMac_Error(err); err = OSAGetAppTerminology ( defaultComponent, kOSAModeNull, &fss, defaultTerminology, &didLaunch, &theDesc ); if (err) return PyMac_Error(err); return Py_BuildValue("O&i", AEDesc_New, &theDesc, didLaunch); }
static PyObject *AE_GetAppTerminology(PyObject* self, PyObject* args) { #if defined(__LP64__) PyErr_SetString(PyExc_NotImplementedError, "aem.ae.getappterminology isn't available in 64-bit processes."); return NULL; #else static ComponentInstance defaultComponent; FSRef fsRef; FSSpec fss; AEDesc theDesc; Boolean didLaunch; OSAError err; if (!PyArg_ParseTuple(args, "O&", AE_GetFSRef, &fsRef)) return NULL; err = FSGetCatalogInfo(&fsRef, kFSCatInfoNone, NULL, NULL, &fss, NULL); if (err != noErr) return AE_MacOSError(err); if (!defaultComponent) { defaultComponent = OpenDefaultComponent(kOSAComponentType, 'ascr'); err = GetComponentInstanceError(defaultComponent); if (err) return AE_MacOSError(err); } err = OSAGetAppTerminology(defaultComponent, kOSAModeNull, &fss, 0, &didLaunch, &theDesc); if (err) return AE_MacOSError(err); return BuildTerminologyList(&theDesc, typeAETE); #endif }
static PyObject * PyOSA_GetSysTerminology(PyObject* self, PyObject* args) { AEDesc theDesc = {0,0}; FSSpec fss; ComponentInstance defaultComponent = NULL; SInt16 defaultTerminology = 0; Boolean didLaunch = 0; OSAError err; long modeFlags = 0; if (!PyArg_ParseTuple(args, "O&|i", PyMac_GetFSSpec, &fss, &modeFlags)) return NULL; defaultComponent = OpenDefaultComponent (kOSAComponentType, 'ascr'); err = GetComponentInstanceError (defaultComponent); if (err) return PyMac_Error(err); err = OSAGetAppTerminology ( defaultComponent, modeFlags, &fss, defaultTerminology, &didLaunch, &theDesc ); if (err) return PyMac_Error(err); return Py_BuildValue("O&i", AEDesc_New, &theDesc, didLaunch); }