OSErr WriteScriptParams (GPtr globals) { PIWriteDescriptor token = NULL; // token to write our parameters to OSErr err = noErr; // we'll return any error with this if (DescriptorAvailable(NULL)) { // Descriptor suite is available. Open a token: // PIUtilities has a routine that will create a descriptor to write // parameters to: token = OpenWriter(); if (token) { // was able to create the token, write our keys: PIPutInt(token, keyHorizontal, gPointH); PIPutInt(token, keyVertical, gPointV); PIPutInt(token, keyXFactor, gXFactor); PIPutBool(token, keyGaussianBlurData, gGaussianBlurData); // PIUtilities has a routine that will close the token, collapse // it, and store it in the struct that the host will then grab // and store for recording and/or subsequent scripting. It tells // the host that the dialog is optional. You can override this // by setting recordInfo to whatever you need. It then // deallocates token and sets it to NULL: err = CloseWriter(&token); } // wasn't able to create token } // descriptor suite unavailable return err; } // end WriteScriptParams
OSErr WriteScriptParams (GPtr globals) { PIWriteDescriptor token = NULL; // token to write our parameters to OSErr err = noErr; // we'll return any error with this if (DescriptorAvailable(NULL)) { // Descriptor suite is available. Open a token: // PIUtilities has a routine that will create a descriptor to write // parameters to: token = OpenWriter(); if (token) { // was able to create the token, write our keys: // Write scripting keys and values here. // See PIActions.h and PIUtilities.h for // routines and macros for scripting functions. // PIUtilities has a routine that will close the token, collapse // it, and store it in the struct that the host will then grab // and store for recording and/or subsequent scripting. It tells // the host that the dialog is optional. You can override this // by setting recordInfo to whatever you need. It then // deallocates token and sets it to NULL: err = CloseWriter(&token); } // wasn't able to create token } // descriptor suite unavailable return err; } // end WriteScriptParams
OSErr WriteScriptParams (GPtr globals) { PIWriteDescriptor token = NULL; double percent = gPercent; OSErr gotErr = noErr; if (DescriptorAvailable(NULL)) { /* recording. Do our thing. */ token = OpenWriter(); if (token) { PIPutEnum(token, keyMyArea, typeMySelect, EnumToKey(gWhatArea, typeMySelect)); if (gWhatArea == iSelectRandom) PIPutUnitFloat(token, keyMyAmount, unitPercent, &percent); PIPutEnum(token, keyMyChannels, typeMyComposite, EnumToKey(gWhatChannels, typeMyComposite)); PIPutEnum(token, keyMyCreate, typeMyCreate, EnumToKey(gCreate, typeMyCreate)); gotErr = CloseWriter(&token); /* closes and sets to dialog optional */ /* done. Now pass handle on to Photoshop */ } } return gotErr; }
int CSocketTcp::Close(int aReason) { #ifdef WIN32 // We need the following call to make things work correctly on // Win32, which requires use to do a <CloseWriter> before doing the // close in order to avoid losing data. Note that we don't need to // do this on UNIX since it doesn't have this "feature". Moreover, // this will cause subtle problems on UNIX due to the way that // fork() works. if (m_Handle != CM_INVALID_HANDLE && aReason == REASON_SUCCESSFUL) CloseWriter(); #endif // WIN32 return CSocketBase::Close(); }