Get the app that opened an Applet

Is it possible to get the name of the App which has opened an Applet with some files? I want to differentiate if they come from Finder or Photos App. Alternatively I would like to get the “second frontmost” app as my Applet is already the frontmost App. Any ideas?

There is (was?) some sender identification information in the open AppleEvent but I don’t know of a good way of getting at it from AppleScript.

	#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
	keySenderEUIDAttr             = 'seid', /* read only, returned as typeSInt32.  Will be the euid of the sender of this event. */
	keySenderEGIDAttr             = 'sgid', /* read only, returned as typeSInt32.  Will be the egid of the sender of this event. */
	keySenderUIDAttr              = 'uids', /* read only, returned as typeSInt32.  Will be the uid of the sender of this event. */
	keySenderGIDAttr              = 'gids', /* read only, returned as typeSInt32.  Will be the gid of the sender of this event. */
	keySenderPIDAttr              = 'spid', /* read only, returned as typeSInt32.  Will be the pid of the sender of this event. */
	keySenderAuditTokenAttr		= 'tokn', /* read only, returned as an audit_token_t.  Will be the audit token of the sender of this event. */
	#endif

The applet shell will have received the AppleEvent and possibly sent is reply before the on open handler is invoked.

Thanks for the prompt reply. Maybe it’s impossible anyway because I also want to differentiate, if the items are dropped onto the Dock Icon or opened through the “Open with” command from the Photos app. So the App name is not enough.