Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Click here to return to the '10.5: Find current Space number via AppleScript' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.5: Find current Space number via AppleScript
Authored by: chucky23 on Mar 05, '08 12:07:57PM
"This works (returns the number of the space I am in), but there really ought to be a better way."

Agreed. Apple should have genuine AppleScript hooks into Spaces, but they don't as of yet.

I was amazed I was able to get this working just by using GUI scripting.


"Is there an applescript way to change to a specified space"

Yup. Just simulate the keystroke with AppleScript.

For example, I have my prefs set up to switch to a space by hitting a number with control. So the following AppleScript will switch me to Space "1":

tell application "System Events"
keystroke "1" using control down
end tell


"or to get the application assigned in a space?"

Check out this hint:

[ Reply to This | # ]