Yes, that's why I requested the new Space Changed Trigger and am delighted that @peternlewis included it with Keyboard Maestro v11.
Soon I'll be updating these macros: Desktop Spaces • Macros to Improve Navigation and Window Management
Incidentally, this is the WhichSpace AppleScript that works most reliably:
tell application "System Events"
tell process "WhichSpace"
set DesktopSpaceList to (title of menu bar items of menu bar 1)
end tell
end tell
return item 1 of DesktopSpaceList
If you run the AppleScript in Script Debugger you'll see the rationale for item 1 of DesktopSpaceList
.