Friday, November 28, 2008

Not so new script for Space Toggle

Some guy from macosxhint.com left nice comment with this script. This works better and is with elegance.


tell application "System Events"
tell expose preferences
tell spaces preferences
set spaceset to item 1 of (get properties as list)
set spaces enabled to (not (spaceset as boolean))
if spaceset is true then
say "Space turned off"
else
say "Space turned on"
end if
end tell
end tell
end tell
update:
After upgrade to Snow Leopard this script didn't worked.
Later I found out 'item 1" should be modified to "item 5"

Wednesday, July 30, 2008

Applescript for Space on/off

If you are using Macbook or MBP with big external monitor, you might find that you don't need Space in dual monitor setting.  However, when you find yourself without big shiny monitor, you would miss Space again.

Turning on/off from Space Preference pane every time can be very painful for most of us.

Here is the applescript i am using. This is my first script and i think that i am going to like applescript a lot.

if (do shell script "defaults read com.apple.dock workspaces") is equal to "1" then

do shell script "defaults write com.apple.dock workspaces -bool no;killall Dock"

say "Space turned off"

else

do shell script "defaults write com.apple.dock workspaces -bool yes;killall Dock"

say "Space turned on"

end if


You can use Script Editor to use the script above or you can download little app i made for myself with growl notification and voice prompt.


Download Space Toggler here