Detecting Method of Launch

I got a tough one for you today!

I’m looking to detect the method that was used to launch a script so that I can do different things depending.

Basically I have an AS Studio app that has two modes - one processing mode where it runs, does some processing then quits. The other mode is ‘settings mode’ where preferences can be set including to set the script to run on login, where it adds itself to the login items.

Both these modes are in the same app, and I want ‘settings mode’ to be triggered if the script was launched by the user, and the ‘processing mode’ to be triggered if the script was launched by System Events as a login item.

Does anyone know if this sort of thing is possible, or how else I could do it?

Good luck figuring it out, I know its a tough one!

Cheers
Ryan