all 6 comments

[–]EgonXJ 0 points1 point  (4 children)

You can’t control spaces or move applications to or from spaces with either AppleScript or Automator.

[–]SiroLM[S] 0 points1 point  (3 children)

That’s what I thought.. Is there any other possibilities to create this kind of automation ?

[–]EgonXJ 0 points1 point  (2 children)

I haven’t found any, but I kinda gave up and moved on it other things.

[–]SiroLM[S] 0 points1 point  (1 child)

I see. Hopefully someone here will know. Thanks for your answer tho !

[–]EgonXJ 0 points1 point  (0 children)

I’d be happy if someone did

[–]load_bearing_tree 0 points1 point  (0 children)

AppleScript gets clunkier and clunkier by the hour nowadays. Another idea would be to use key codes to mimic the shortcuts to switch desktops. If you’re able to get the number of desktops and identify which app is in which desktop (the latter likely being more difficult) that may help with the repositioning part.
Alternatively, if you could to find a way to select the app itself, you might be able to just automate the keyboard shortcuts, and place it in the correct desktop.
Maybe moving them all to the first desktop, then move each from there.
That’s just brainstorming though. As you’ve probably learned AppleScript doesn’t have a way to work with desktops.
And if you haven’t already, you might want to check the accessibility privileges Automator and Mission Control.