Move a window to current desktop

Hey SH,

Spaces doesn’t have an open API, so there’s not a lot Peter can do to manage them.

In your case an Execute an AppleScript action will do the trick…

------------------------------------------------------------
# Your folder.
set theFolder to alias ((path to downloads folder as text) & "test:")
------------------------------------------------------------
tell application "System Events"
  if quit delay ≠ 0 then set quit delay to 0
  tell application process "Finder"
    if its visible is false then set its visible to true
    set frontmost to true
  end tell
end tell
tell application "Finder" to open theFolder
------------------------------------------------------------

This should open the designated folder in the current Space’s Finder, but if the folder is already open in another Space it will switch to it.

Unfortunately you cannot differentiate Finder windows in different spaces, but you can detect whether the folder is in fact open.

tell application "Finder"
  set winList to windows whose name is "Downloads"
  if length of winList > 0 then
    # Do something.
  else
    # Do something else.
  end if
end tell

-Chris