Beispiel #1
0
//-------------------------------------------------------------------------------
//
//	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, &currentDocumentID, 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);
}
Beispiel #2
0
Logger::Logger( const char * inString )
{

	if (GetFullPathToDesktop(fullPath, MAX_PATH))
	{
		fullPath[0] = '\0';
	}
	
	strncat(fullPath, inString, MAX_PATH-1);
	fullPath[MAX_PATH-1] = '\0';

	strncat(fullPath, ".log", MAX_PATH-1);
	fullPath[MAX_PATH-1] = '\0';
	
}
Beispiel #3
0
//-------------------------------------------------------------------------------
//
//	EventDumper
//
//	This is the routine that gets notified for all events from Photoshop.
//
//	You can only have one listening proc registered per event, but you
//	can have the same listening proc for multiple events.
//
//	Use "eventAll" to get notification of all actions events.   
//
//	MACINTOSH WARNING: Due to resource management problems, when this
//	routine is called, **YOUR RESOURCE FORK IS CLOSED**.  If you need
//	resources from your fork, load them during startup or call your
//	own plug-in using a Play() command.
//
//	The notifier is intended to show an automation plug in programmer
//	how to put event descriptors together. The DumpDescriptor routine
//	takes the event that just happened and walks through the descriptor
//	dumping everything that it finds.
//
//	NOTE: THIS IS FOR THE DEBUG BUILD OF THIS PLUG IN ONLY. THE DEBUG
//	LIBRARY IS RATHER LARGE AND YOU PROBABLY DON'T WANT IT IN YOUR
//	SHIPPING PLUG IN.  
//	
//-------------------------------------------------------------------------------
static void EventDumper
	(
	/* IN */	DescriptorEventID		 event ,		// Incoming event.
	/* IN */	PIActionDescriptor		 descriptor ,	// Event descriptor.
	/* IN */	PIDialogRecordOptions	 /*options*/,		// Outgoing dialog options.
	/* IN */	void*					/*data*/			// Your user data. 
)
{
	char logfilename[256];
	char* filename = "Listener.log";
	
	SPErr error = GetFullPathToDesktop(logfilename, 256);
	if (error)
		strcpy(logfilename, "");

	strcat(logfilename, filename);

	PIUDumpDescriptor(event, descriptor, logfilename);
}