Move Application Window to another Space

Hi, I have Spaces set up on my Mac and would like to make a script that can move an iChat window 2 spaces to the right and 1 down (to the 6th space) .

Any ideas?

Any help would be appreciated! :slight_smile:

Don’t worry, I fixed my own problem! I found a set of spaces applescripts at http://soylentfoo.jnewland.com/articles/2007/11/22/spaces-application-assignments-and-applescript and modified one of them to move iChat to space 6…

if application "iChat" is running then
    set app_identifier to bundle identifier of (info for ("Macintosh HD:Applications:iChat.app:" as alias))
    set app_identifier to do shell script "echo " & quoted form of app_identifier & " | /usr/bin/perl -pe 'use encoding utf8; s/(\\w)/\\L$1/gi'"
    set theNumber to ("6") as number
    set app_construct to (run script "{|" & app_identifier & "|: " & theNumber & "}")
    
    tell application "System Events"
        tell spaces preferences of expose preferences
            set app_layout to application bindings
        end tell
    end tell
    set app_identifier to bundle identifier of (info for (path to frontmost application))
    try
        app_layout as number -- causes an error anyway
    on error errstr
        set app_locations to {}
        set {TID, text item delimiters} to {text item delimiters, "{"}
        set errstr to text item 2 of errstr
        set text item delimiters to "}"
        set errstr to text item 1 of errstr
        set text item delimiters to ", "
        set errstr to text items of errstr
        set text item delimiters to TID
        repeat with i in errstr
            set o to offset of "|:" in i
            tell i
                set app_location to {}
                set end of app_location to text 2 thru (o - 1)
                set end of app_location to text (o + 2) thru -1
                set end of app_locations to app_location
            end tell
        end repeat
    end try
    set spaces_bindings to {}
    repeat with i from 1 to count app_locations
        if app_identifier = item 1 of (item i of app_locations) then
            --skip it
        else
            set spaces_bindings to spaces_bindings & (run script "{|" & item 1 of (item i of app_locations) & "|: " & item 2 of (item i of app_locations) & "}")
        end if
    end repeat
    tell application "System Events"
        tell expose preferences
            tell spaces preferences
                set application bindings to spaces_bindings
                set spaces_bindings to app_construct & spaces_bindings
                set application bindings to spaces_bindings
            end tell
        end tell
    end tell
end if