• Apfeltalk ändert einen Teil seiner Allgemeinen Geschäftsbedingungen (AGB), das Löschen von Useraccounts betreffend.
    Näheres könnt Ihr hier nachlesen: AGB-Änderung
  • Im Monat Februar heisst es: Ab in die Welt und Quadrate aufspüren und fotografieren! Quadrat zum Quadrat ist unser Motto und wieder einmal setzen wir auf Eure Kreativität. Hier geht es lang --> Klick

Fenster vom 2. zum 1. Desktop bewegen via Applescript (Teillösung)

Rohosch

Erdapfel
Registriert
12.02.25
Beiträge
1
Folgendes Script sucht auf dem 2. Desktop (2. Monitor links) nach offenen Programmen und deren Fenster, um sie auf den 1. Desktop (1. Monitor) übereinander abzulegen. Funktioniert auch.

Da ich das Script eigenhändig ohne wirkliche Programmierkenntnisse zusammengebaut habe, läuft es leider nicht schnell genug. Hat jemand eine Lösung?

AppleScript:
tell application "System Events"
    repeat with proc in (application processes where background only is false)
        tell proc
            log "found app: " & name
            set processName to name
            log (count of windows)
            repeat with win in windows
                set position of window 1 to {30, 50}
                if (count of windows) > 1 then
                    if exists window 2 then
                        set position of window 2 to {60, 100}
                    end if
                    if (count of windows) > 2 then
                        if exists window 3 then
                            set position of window 3 to {90, 100}
                        end if
                        if (count of windows) > 3 then
                            if exists window 4 then
                                set position of window 4 to {120, 100}
                            end if
                            if exists window 5 then
                                set position of window 5 to {150, 100}
                            end if
                            if exists window 6 then
                                set position of window 6 to {180, 100}
                            end if
                        end if
                    end if
                end if
                
            end repeat
            if exists window 7 then
                say "mehr als 6 Fenster gefunden"
            end if
        end tell
    end repeat
    beep
end tell