3

In Snow Leopard (10.6), I had an applescript that toggled iTunes between "maximised on Space 2" and "mini-player on all spaces":

set app_identifier to do shell script "echo 'com.apple.iTunes' | /usr/bin/perl -pe 'use encoding utf8; s/(\\w)/\\L$1/gi'"

tell application "iTunes"
    # if it's not already minimised...
    if minimized of front browser window is false then
        # switch to mini player
        set minimized of front browser window to true
        # set it to show on all spaces (the magic here is the "65544").
        set app_construct to (run script "{|" & app_identifier & "|: 65544}")
        tell application "System Events"
            tell expose preferences
                tell «class essp»
                    set spaces_bindings to get «class spcs»
                    set spaces_bindings to app_construct & spaces_bindings
                    set «class spcs» to spaces_bindings
                end tell
            end tell
        end tell
    else
        # switch to normal player
        set minimized of front browser window to false
        # set it to show on Space 2 (the magic here is the "2" - compare to the "65544" in the "set to all spaces" version).
        set app_construct to (run script "{|" & app_identifier & "|: 2}")
        tell application "System Events"
            tell expose preferences
                tell «class essp»
                    set spaces_bindings to get «class spcs»
                    set spaces_bindings to app_construct & spaces_bindings
                    set «class spcs» to spaces_bindings
                end tell
            end tell
        end tell
    end if
end tell

That's based on scripts from http://soylentfoo.jnewland.com/articles/2007/11/22/spaces-application-assignments-and-applescript .

This doesn't work on Lion.

Does anyone know the equivalent to "assign this app to all spaces" and "assign this app to space 2" in Lion?

You must log in to answer this question.

Browse other questions tagged .