//------------------------------------------------------------------------------- // // 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); }
int MiniGUIMain (int argc, const char *argv []) { HWND hMainWnd; MSG Msg; MAINWINCREATE CreateInfo; #ifdef _MGRM_PROCESSES int i; const char* layer = NULL; for (i = 1; i < argc; i++) { if (strcmp (argv[i], "-layer") == 0) { layer = argv[i + 1]; break; } } GetLayerInfo (layer, NULL, NULL, NULL); //if (JoinLayer ("same","same"/* argv[0]*/, 0, 0) == INV_LAYER_HANDLE) { if (JoinLayer (layer, argv[0], 0, 0) == INV_LAYER_HANDLE) { printf ("JoinLayer: invalid layer handle.\n"); exit (1); } #endif InitCreateInfo (&CreateInfo); hMainWnd = CreateMainWindow (&CreateInfo); if (hMainWnd == HWND_INVALID) return -1; srand (time (NULL)); ShowWindow (hMainWnd, SW_SHOWNORMAL); while( GetMessage (&Msg, hMainWnd) ) { TranslateMessage (&Msg); DispatchMessage (&Msg); } MainWindowThreadCleanup (hMainWnd); return 0; }