Time Since Latest 'Space change'?

This might be a question for @peternlewis but if anyone else knows the answer please weigh in! :grinning:

I'm using several Mission Control Desktop Spaces with my MacBook Pro.

I have a macro that activates one of several applications. Within that macro, I'd like to determine if that activation caused a desktop space change (which would be that case if the activated application was previously open in another space and the same application is not assigned to all desktops).

Within that macro, is there any way to retrieve the elapsed time since the latest Space change, if not that, the time that any macro within the library was started because of a Space changes trigger?

Note that the macro does not include a Space changes trigger.

Thanks in advance!!

If the macro does not include a space change trigger, then you could create a macro with the space change trigger that does nothing but set the current time in a global variable. Then you could easily calculate "the elapsed time since the last space change" by subtracting the value of the saved variable from the expression "SECONDS()".