Trigger on open document vs launch?

For the purpose of triggering KM, is there a way to distinguish between launching the app directly and launching an existing document?

I have an app that launches with a default behavior of creating no new document. I have a KM macro that triggers on app launch, and creates a new document, and arranges the window as I like. This works fine, until I double-click on an existing document to launch the app. It opens the document, but it also makes a new empty one per my macro.

Is there a way around this in KM?

After the application launches and triggers the macro, pause a short while and determine whether there is a document open, and if not, create the new document. You can probably detect the open document by testing to see if the Close menu is enabled, or by using the WINDOWCOUNT function.

Thanks – it worked like a charm!