Detect Space/Desktop

I'd really like to be able to create context-aware commands depending on what space/desktop I'm in in Mission Control. It does not appear that there is an easy/reliable way to do this with AppleScript; If there's a way to include this in BTT, it would be invaluable!