Moving an already opened application into a different Space?

This question concerns Applescript control of the Spaces application in Leopard and Snow Leopard.

Is there an Applescript way to tell an already opened application to move from one Space to another?

I have the Hyperspaces application installed, if that might help. However, it doesn’t seem to be Applescript-able.

I’ve searched for a way in Applescript to move an open app from one Space to another, and so far, I’ve come up empty-handed. Will that have to be my ultimate fate, or is there a way to do this that I might have overlooked?

Thanks in advance.

Model: MacBook Pro
Browser: Firefox 3.5.3
Operating System: Mac OS X (10.6)

This is the best collection of scripts for spaces…
http://macscripter.net/viewtopic.php?id=23453

Thank you very much!

Model: MacBook Pro
AppleScript: 2.1
Browser: Firefox 3.5.3
Operating System: Mac OS X (10.6)

I have a related question: is there any way to query the system in AppleScript to find out which Space is currently showing on the screen? That function is not part of the excellent collection of scripts mentioned above.

Thanks in advance.

I’m updating this question for Lion. The scripts mentioned above don’t seem to work in 10.7.x.

Can anyone point me to some docs which explain how to use AppleScript in Lion to switch from space to space, and to tell an already opened application to switch to another space?

Thanks in advance.

Don’t confuse Snow Leopard with Lion. There is no Spaces application in Lion. There is mission control, through which you control your different desktops.

I think if the word “desktop” is swapped for “space” and “Mission Control” is swapped for “Spaces” the question still holds. How can window assignment to a space, er desktop, be controlled at runtime by a script?

Or has Lion done more than repackage the Spaces feature, and changed its fundamental meaning?

I don’t think Spaces exists anymore. The question now is wheather Mission Control is scriptable or not.

I believe the underlying technology hasn’t changed as much as you may think. I really do think that Mission Control is primarily a new GUI wrapper around some of the same stuff.

E.g. I use Afloat (http://infinite-labs.net/afloat/), and it still has a “Keep this window on the screen on all Spaces” option that still works perfectly working with Lion.

You’re right that I should have used Lion-specific terminology.

Nonetheless, the following script collection no-longer works under Lion, at least insofar as changing the “Desktop” (formerly “Space”) in which a window appears: http://macscripter.net/viewtopic.php?id=23453

I’m looking for an alternative.

By the way, the Mission Control application doesn’t appear in the Open Dictionary selector in Lion’s AppleScript Editor, and Mission Control is greyed out if I try to access it via Browse in this Open Dictionary selector. So it appears that Mission Control is not directly scriptable.

Thanks to all.

PS: The “Operating system” dropdown at the bottom of this article submission screen doesn’t yet contain any 10.7.x entries.