//------------------------------------------------------------------------------- // // DoIt // // Finally something interesting. You have been selected from your menu entry // or via the actions system to do your thing. Dump everything you can about // Photoshop by asking Photoshop. The output file is "Getter.log". // //------------------------------------------------------------------------------- SPErr DoIt(PSActionsPlugInMessage * /*message*/) { SPErr error = 0; char logfilename[MAX_PATH]; char* filename = (char*)"Getter.log"; error = GetFullPathToDesktop(logfilename, MAX_PATH); if (error) { logfilename[0] = '\0'; error = 0; } strncat(logfilename, filename, MAX_PATH-1); logfilename[MAX_PATH-1] = '\0'; GetApplicationInfo(logfilename); GetLayerInfo(logfilename); GetActionInfo(logfilename); GetDocumentInfo(logfilename); GetChannelInfo(logfilename); GetBackgroundInfo(logfilename); // the above routines can do their job by indexing into the open objects // path info and history info are only available to the target document // 1. remember who is the current target // 2. target the other documents by indexing // 3. switch back to the original target // (use the ID it is the most reliable way to switch back) int32 currentDocumentID = 0; int32 numDocuments = 0; int32 docCounter = 0; // we are ignoring errors so this will not give an invalid error // message when there are no documents open (void) PIUGetInfo(classDocument, keyDocumentID, ¤tDocumentID, NULL); (void) PIUGetInfo(classApplication, keyNumberOfDocuments, &numDocuments, NULL); if (numDocuments > 0) { for (docCounter = 1; docCounter <= numDocuments; docCounter++) { // this routine will error if we select the document // that is already selected, we don't care about this // as an error, keep chugging (void) PIUSelectByIndex(classDocument, docCounter); GetPathInfo(logfilename); GetHistoryInfo(logfilename); } // this routine will error if we select the document // that is already selected, we don't care about this // as an error, keep chugging (void) PIUSelectByID(classDocument, currentDocumentID); } return (error); }
/* * Type is used to determine whether the file is expected * to exist or not. It is overloaded (temporarily) to control * Flag which indicates whether an error is treated as an error * or not. The StreamFiles.txt script does not have the Type * parameter set correctly for all 120,000+ lines. As a result * it is not possible to enforce the presence test throughout * the entire script. */ int nb_qpathinfo(char *fname, int Type) { pstring path; int rc; char FileName[128]; char temp[512]; DWORD gle = 0; if (Type == 1111) { EnforcePathInfoErrors = 1; Type = 1; } else if (Type == 1001) { EnforcePathInfoErrors = 0; Type = 1; } else if (Type == 1000) { EnforcePathInfoErrors = 0; Type = 0; } else if (Type == 1110) { EnforcePathInfoErrors = 1; Type = 0; } sprintf(FileName, "Thread_%05d.log", ProcessNumber); strcpy(path, AfsLocker); strcat(path, fname); StartFirstTimer(); rc = GetPathInfo(path, NULL, NULL, NULL, NULL, NULL); if (rc == 0) gle = GetLastError(); if (strstr(fname, "~TS")) { if (rc == 0) rc = 1; else rc = 0; } if (!EnforcePathInfoErrors) { if (Type) { if (rc) rc = 0; else rc = 1; } if (!rc) { EndFirstTimer(CMD_QUERY_PATH_INFO, 0); LeaveThread(0, "", CMD_QUERY_PATH_INFO); sprintf(temp, "File: qpathinfo failed for %s type %d GLE(0x%x)\n", path, Type, gle); if (verbose) printf("%s", temp); LogMessage(ProcessNumber, HostName, FileName, temp, LogID); return(-1); } } EndFirstTimer(CMD_QUERY_PATH_INFO, 1); return(0); }