Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to move a window to a certain desktop with AppleScript?

Tags:

applescript

I have an application/window on Desktop 1 (OS X Lion) and I'd like to move it to Desktop 3. Any insights on how to do this? Not as big a deal, but if possible I'd like to ensure there are 3 and only 3 Desktops available.

like image 915
ryonlife Avatar asked Mar 19 '12 17:03

ryonlife


People also ask

Why is AppleScript so slow?

Don't overdo AppleScript formatting. Unfortunately, the more formats you use, the slower your compiles will be. The slowdown is caused when your script editor is forced to cope with growing numbers of style runs as it displays your script following a compile.

Can you run AppleScript on Windows?

You can't. Applescript is unique to Mac OS.

What script does Apple use?

AppleScript is an English-like language used to create script files and applets that control the actions of the computer and the applications that run on it.


1 Answers

This answer should offer clues on how to do place applications, specifically...

tell application "System Events"
    set x to application bindings of spaces preferences of expose preferences
    set x to {|com.apple.textedit|:4} & x  -- Have TextEdit appear in space 4
    set application bindings of spaces preferences of expose preferences to x
end tell

I would imagine moving a window is not too different.

like image 94
Philip Regan Avatar answered Oct 16 '22 08:10

Philip Regan