Pick of the Week - Nov 10 [Show all picks]
Path Finder 5 - A feature-laden Finder replacement
Submit Hint Search The Forums LinksStatsPollsFAQHeadlinesRSS
12,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 whomever posted them. This site is not responsible for what they say.
10.5: Find current Space number via AppleScript
Authored by: chucky23 on Wed, Mar 5 2008 at 12:07PM PST
"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:

http://www.macosxhints.com/article.php?story=20071217092214986


[ Reply to This | # ]