Seite 2 von 2 ErsteErste 12
Ergebnis 11 bis 20 von 20
  1. #11
    London Pepping
    Themenstarter
    Avatar von Guy.brush
    Registriert
    12.2008
    Ort
    X
    Beiträge
    2.050
    Ok, ich hab noch eines geschrieben, diesmal für alle aktiven Apps. Allerdings muss man feststellen, dass es nicht mit allen Apps klarkommt, siehe Script Kommentar, was wohl schon ein großes Manko ist. Aber für die wirklich wichtigen Apps funktioniert es.

    Es ordnet die Applikationen auf folgende Weise an (die Nummer ist die Anzahl der aktiven Applikationen):

    (0) Nichts
    (1) Zentriere Fenster (oder alternativ: Vollbild)
    (2) Vertikal halbierter Screen, beide Apps mit voller Screen Höhe
    (3) Vertikal halbierter Screen, eine Seite zusätzlich horizontal halbiert, eine App hat volle Höhe, 2 halbe Höhe
    (4) Vertikal und horizontal halbierter Screen, 4 gleich große Fenster mit halber Breite und Höhe
    (5) Nichts
    ...

    Die Applikationen, bei denen die Darstellung überhaupt nicht klappt, werden rausgefiltert (z.B. iTunes, Firefox, Thunderbird, Preview).

    Hier das Script:

    Code:
    -- Arrange Windows Script Version 1.3.1
    -- Script ordnet Fenster automatisch am Bildschirm an (funktioniert nur für sichtbare Fenster, d.h. nicht für ausgeblendete oder minimierte), entworfen für Dock am unteren Rand
    -- erfolgreich getestet mit: Safari, Mail, Finder, Fraise, iCal, QuickTime Player, VLC, Pages, Keynote, AppleScript Editor
    -- funktioniert nicht mit: Firefox, Thunderbird, Preview, iTunes, Adium
    -- Wackelkandidaten: Automator, Terminal, EyeTV, Numbers, Xcode
    
    global screen_width, screen_height, margin_west, margin_east, split_height, split_width, menubar_height, appList, dock_height
    
    -- für eine Auflösung von 1920x1200
    set screen_width to 1920
    set screen_height to 1200
    set menubar_height to 44
    set dock_height to 150 -- mit etwas Freiraum
    
    -- Seitenabstand, für fullscreen beides auf 0 setzen
    set margin_west to 50
    set margin_east to 50
    
    -- Maße für Fenster
    set split_width to (screen_width - (margin_west + margin_east)) / 2
    set split_height to (screen_height - dock_height) / 2
    
    -- Apps, deren Fenster möglichst das größte sein sollte (für 3 Fenster) -> konflikt bei mehreren
    set priorityAppList to {"Safari", "Pages"}
    
    -- diese Programme werden vom Fenstermanagement ausgeschlossen
    set badAppList to {"iTunes", "firefox-bin", "thunderbird-bin", "Preview", "Adium"}
    
    set activeAppList to {}
    -- aktive Programme bestimmen
    tell application "Finder"
    	set activeAppList to (get the name of every process whose visible is true)
    	
    	-- Finderfenster entfernen, wenn nicht geöffnet
    	if not (the first window exists) then
    		rest of activeAppList
    		set activeAppList to items 2 thru -1 of activeAppList
    	end if
    end tell
    
    -- Anzahl der active_apps
    set counter to 0
    set counter to count of items of activeAppList
    
    set appList to {}
    
    -- Apps herausfiltern (badApps, Apps ohne Priorität) 
    repeat with i from 1 to counter
    	set element to item i of activeAppList
    	if ((element is not in appList) and (element is not in priorityAppList) and (element is not in badAppList)) then
    		set appList's end to element
    	else if (element is in badAppList) then
    		set counter to counter - 1
    	end if
    end repeat
    
    -- priority Apps am Ender der Liste hinzufügen, denn diese werden zum Schluss erzeugt (fullEastSide usw.)
    repeat with i from 1 to count of priorityAppList
    	set listItem to item i of priorityAppList
    	if (listItem is in activeAppList) then set appList's end to listItem
    end repeat
    
    -- Hauptauswahl,  counter = Anzahl der Fenster
    if counter = 4 then
    	
    	upperWestside(item 1 of appList)
    	lowerWestside(item 2 of appList)
    	upperEastside(item 3 of appList)
    	lowerEastside(item 4 of appList)
    	
    else if counter = 3 then
    	
    	-- "2x1"
    	upperWestside(item 1 of appList)
    	lowerWestside(item 2 of appList)
    	fullEastside(item 3 of appList)
    	
    	-- alternative "1x2" 
    	(*
    		upperEastside(item 1 of appList)
    		lowerEastside(item 2 of appList)
    		fullWestside(item 3 of appList)
    		*)
    	
    else if counter = 2 then -- split 2 applications
    	
    	fullWestside(item 1 of appList)
    	fullEastside(item 2 of appList)
    	
    else if counter = 1 then
    	
    	centerWindow(item 1 of appList)
    	--alternativ fullSize(item 1 of appList)
    	
    else
    	-- display dialog "Choose max. 4 applications!"
    end if
    
    -- Funktionen zum Platzieren von Fenstern
    -- links oben
    on upperWestside(appname)
    	tell application (appname)
    		try
    			set the bounds of the first window to {margin_west, 0, margin_west + split_width, split_height}
    		end try
    		activate
    	end tell
    end upperWestside
    
    -- links unten
    on lowerWestside(appname)
    	tell application appname
    		try
    			set the bounds of the first window to {margin_west, split_height + menubar_height, margin_west + split_width, split_height * 2 + menubar_height}
    		end try
    		activate
    	end tell
    end lowerWestside
    
    -- linke Hälfte 
    on fullWestside(appname)
    	tell application appname
    		try
    			set the bounds of the first window to {margin_west, 0, margin_west + split_width, split_height * 2}
    		end try
    		activate
    	end tell
    end fullWestside
    
    -- rechts oben
    on upperEastside(appname)
    	tell application appname
    		try
    			set the bounds of the first window to {margin_west + split_width, 0, margin_west + split_width * 2, split_height}
    		end try
    		activate
    	end tell
    end upperEastside
    
    -- rechts unten
    on lowerEastside(appname)
    	tell application appname
    		try
    			set the bounds of the first window to {margin_west + split_width, split_height + menubar_height, margin_west + split_width * 2, split_height * 2 + menubar_height}
    		end try
    		activate
    	end tell
    end lowerEastside
    
    -- rechte Hälfte 
    on fullEastside(appname)
    	tell application appname
    		try
    			set the bounds of the first window to {margin_west + split_width, 0, margin_west + split_width * 2, split_height * 2}
    		end try
    		activate
    	end tell
    end fullEastside
    
    -- fullSize 
    on fullSize(appname)
    	tell application appname
    		try
    			set the bounds of the first window to {margin_west, 0, margin_west + split_width * 2, split_height * 2}
    		end try
    		activate
    	end tell
    end fullSize
    
    -- centerWindow
    on centerWindow(appname)
    	tell application appname
    		try
    			set the bounds of the first window to {(screen_width - split_width) / 2, 0, (screen_width + split_width) / 2, screen_height - dock_height}
    		end try
    		activate
    	end tell
    end centerWindow
    It's more fun to be a pirate than to join the navy.

  2. #12
    Luxemburger Triumph Avatar von sedna
    Registriert
    10.2008
    Beiträge
    498
    Hallo!
    Das wird ja langsam was.

    Zwei Tipps:
    Programme, die nicht skriptfähig sind, verstehen bounds nicht. Dort stellt man die Größe mit position und size ein.
    Wackelkandidaten gibt es immer wieder. Das eine Programm verlangt 44 für Oberkante, andere 0 oder 22 ...

    Ich habe leider keine Zeit, dir tatkräftig unter die Arme zu greifen. Dafür hier aber zwei Codeschnippsel zum basteln:
    (Dann klappt es auch mit Firefox und Vorschau)

    Code:
    tell application "Finder"
    	set {x1, y1, x2, y2} to get bounds of window of desktop
    	set res to {x2, y2}
    end tell
    Code:
    tell application "System Events"
    	set frontApp to name of first application process whose frontmost is true
    	--set appFile to (get application file of process frontApp) as Unicode text
    	set appname to displayed name of process frontApp
    	
    	tell process appname
    		-- nicht immer ist window 1 das "erste" sichtbare Fenster !
    		try
    			set w1 to (get first window whose visible is true)
    		on error
    			set w1 to front window
    		end try
    		tell w1
    			set position to {10, 10}
    			set size to {900, 700}
    		end tell
    	end tell
    end tell
    Gruß

  3. #13
    Wohlschmecker aus Vierlanden
    Registriert
    11.2009
    Beiträge
    236
    Eine mögliche Alternative findet sich hier: Tile Screen (AppleScript Utility Set)
    Kommunikation -> Kooperation -> Innovation

  4. #14
    London Pepping
    Themenstarter
    Avatar von Guy.brush
    Registriert
    12.2008
    Ort
    X
    Beiträge
    2.050
    Danke, auch nicht schlecht. Nur behandeln diese Scripts immer nur das Front Window. Ich versuche es doch noch ein bisschen mehr zu automatisieren. Vielleicht kann ich mir aber doch das ein oder andere abschauen, wenn ich wieder Zeit und vor allem Lust dazu habe.
    It's more fun to be a pirate than to join the navy.

  5. #15
    London Pepping
    Themenstarter
    Avatar von Guy.brush
    Registriert
    12.2008
    Ort
    X
    Beiträge
    2.050
    Ok, danke euch beiden. Hab die Tipps berücksichtigt und mit Hilfe der anderen Skripte meines ein bisschen optimiert.
    Es funktioniert jetzt mit so gut wie jedem Programm, das ist die gute Nachricht.

    Aber es gibt noch einige Probleme:

    • minimierte Fenster werden mitgezählt
    • es dürfen nicht mehr als 4 Apps aktiv sein (+ die ausgeschlossenen, aber inklusive der minimierten)
    • wenn mehr als ein Fenster von einer App aktiv ist, wird nur das erste Fenster berücksichtigt

    Habt ihr Ideen dazu?

    Code:
    -- Arrange Windows Script Version 1.5
    -- Script ordnet Fenster automatisch am Bildschirm an (funktioniert nur für sichtbare Fenster, d.h. nicht für ausgeblendete oder minimierte)
    
    global screen_width, screen_height, margin_west, margin_east, margin_north, margin_south, split_height, split_width, menubar_height, appList
    
    -- für eine Auflösung von 1920x1200
    set screen_width to 1920
    set screen_height to 1200
    
    -- Seitenabstand, für fullscreen auf 0 setzen
    set margin_west to 50
    set margin_east to 50
    set margin_north to 22 -- Menüleiste
    set margin_south to 150 -- etwas Freiraum für das Dock
    
    -- Maße für Fenster
    set split_width to (screen_width - (margin_west + margin_east)) / 2
    set split_height to (screen_height - margin_south) / 2
    
    -- Apps, deren Fenster möglichst das größte sein sollte (für counter = 3 ) -> bei konflikt wird das alphabetisch letzte genommen
    set priorityAppList to {"iTunes", "Safari", "Pages"}
    
    -- diese Programme werden vom Fenstermanagement ausgeschlossen
    set badAppList to {"Adium", "System Preferences"}
    
    set activeAppList to {}
    
    -- aktive Programme bestimmen
    tell application "Finder"
    	set activeAppList to (get the name of every process whose visible is true)
    	
    	-- Finderfenster entfernen, wenn nicht geöffnet
    	if not (the first window exists) then
    		rest of activeAppList
    		set activeAppList to items 2 thru -1 of activeAppList
    	end if
    end tell
    
    -- Anzahl der active_apps
    set counter to 0
    set counter to count of items of activeAppList
    
    set appList to {}
    
    -- Apps herausfiltern (badApps, Apps ohne Priorität) 
    repeat with i from 1 to counter
    	set element to item i of activeAppList
    	if ((element is not in appList) and (element is not in priorityAppList) and (element is not in badAppList)) then
    		set appList's end to element
    	else if (element is in badAppList) then
    		set counter to counter - 1
    	end if
    end repeat
    
    -- priority Apps am Ende der Liste hinzufügen, denn diese werden zum Schluss erzeugt (fullEastSide usw.)
    repeat with i from 1 to count of priorityAppList
    	set listItem to item i of priorityAppList
    	if (listItem is in activeAppList) then set appList's end to listItem
    end repeat
    
    
    -- Hauptauswahl,  counter = Anzahl der Fenster
    if counter = 4 then
    	try
    		sizeAndPos(item 1 of appList, "west up")
    		sizeAndPos(item 2 of appList, "west low")
    		sizeAndPos(item 3 of appList, "east up")
    		sizeAndPos(item 4 of appList, "east low")
    	end try
    	
    else if counter = 3 then
    	-- "2x1"	
    	try
    		sizeAndPos(item 1 of appList, "west up")
    		sizeAndPos(item 2 of appList, "west low")
    		sizeAndPos(item 3 of appList, "east full")
    		
    	end try
    	-- alternativ "1x2" 
    	
    else if counter = 2 then
    	try
    		sizeAndPos(item 1 of appList, "west full")
    		sizeAndPos(item 2 of appList, "east full")
    	end try
    	
    else if counter = 1 then
    	try
    		sizeAndPos(item 1 of appList, "center")
    	end try
    	--alternativ 
    	--sizeAndPos(item 1 of appList, "fullsize")		
    else
    	-- display dialog  "max. 4 applications!"
    end if
    
    -- lege size und position fest
    on sizeAndPos(appname, place)
    	
    	set menubar_height to getSpecialAppDistance(appname)
    	
    	tell application "System Events"
    		tell process appname
    			try
    				set window1 to (get first window whose visible is true)
    			on error
    				set window1 to front window
    			end try
    			tell window1
    				
    				if (place is "west up") then
    					set position to {margin_west, menubar_height}
    					set size to {split_width, split_height}
    					
    				else if (place is "west low") then
    					set position to {margin_west, split_height + margin_north + 1}
    					set size to {split_width, split_height}
    					
    				else if (place is "west full") then
    					set position to {margin_west, menubar_height}
    					set size to {split_width, split_height * 2}
    					
    				else if (place is "east up") then
    					set position to {margin_west + split_width + 1, menubar_height}
    					set size to {split_width, split_height}
    					
    				else if (place is "east low") then
    					set position to {margin_west + split_width + 1, split_height + margin_north + 1}
    					set size to {split_width, split_height}
    					
    				else if (place is "east full") then
    					set position to {margin_west + split_width + 1, menubar_height}
    					set size to {split_width, split_height * 2}
    					
    				else if (place is "fullsize") then
    					set position to {margin_west, menubar_height}
    					set size to {split_width * 2, split_height * 2}
    					
    				else if (place is "center") then
    					set position to {(screen_width - split_width) / 2, menubar_height}
    					set size to {split_width, split_height * 2}
    				end if
    			end tell
    		end tell
    	end tell
    end sizeAndPos
    
    -- get Abstand zur Menüleiste für Problemfälle (für fullEast, fullWest & upperSides)
    on getSpecialAppDistance(appname)
    	
    	set list1 to {"Automator", "Xcode"}
    	
    	if appname is in list1 then
    		return -60
    	else if appname is "iTunes" then
    		return 22
    	else if appname is "EyeTV" then
    		return 44
    	else
    		return 0
    	end if
    end getSpecialAppDistance
    Noch ein Zusatz:
    Ich starte es jetzt immer mit FastScripts, das funktioniert wirklich sehr schnell und bis jetzt fantastisch.

    Gruß,

    Guy.brush

    Edit: hier noch das dazu passende Video:

    Geändert von Guy.brush (02.08.2010 um 21:49 Uhr)
    It's more fun to be a pirate than to join the navy.

  6. #16
    Luxemburger Triumph Avatar von sedna
    Registriert
    10.2008
    Beiträge
    498
    Ideen hätte ich schon, bin aber die nächsten zwei Wochen ohne Mac. Werde mich dann noch mal melden.
    Du kannst mit "count every window" die Fenster auslesen, auch ihren Status bestimmen und nacheinander abarbeiten.
    Da die letzten Positionen der Fenster oft gespeichert werden, wäre es wohl vorteilhaft, die Fensterpositionen zurück zu setzten.
    Und du arbeitest ohne Spaces, oder ? Sonst müssten diese ja auch berücksichtigt werden, was machbar, aber garantiert nicht so leicht umzusetzen ist.

    Ich hatte mir mal ein "ähnliches" Skript geschrieben. Es hat ein paar Fehler, die ich mit meinem heutigen Wissen ausmerzen könnte. Ich werde mich in naher Zukunft noch mal ransetzen und auch auf 2 Display Betrieb erweitern.
    Kannst du dir ja mal anschauen: Hier

    Gruß

  7. #17
    Wohlschmecker aus Vierlanden
    Registriert
    11.2009
    Beiträge
    236
    @sedna: Das AppleScript ist leider als "nur ausführbar" abgespeichert.
    Kommunikation -> Kooperation -> Innovation

  8. #18
    Luxemburger Triumph Avatar von sedna
    Registriert
    10.2008
    Beiträge
    498
    Ja
    Code gebe ich gerne auf Anfrage ... in zwei Wochen.

  9. #19
    London Pepping
    Themenstarter
    Avatar von Guy.brush
    Registriert
    12.2008
    Ort
    X
    Beiträge
    2.050
    Ok, ich denke, das Skript ist jetzt ziemlich einsatzfähig. Hab noch mit eingefügt, dass geschlossene Fenster nicht berücksichtigt werden, d.h. es können mehr als 4 Apps aktiv sein.

    Es gibt also nur noch 2 Hauptprobleme:

    • minimierte Fenster
    • mehrere Fenster eines Programmes

    Hier mal der Downloadlink zum Skript.
    It's more fun to be a pirate than to join the navy.

  10. #20
    London Pepping
    Themenstarter
    Avatar von Guy.brush
    Registriert
    12.2008
    Ort
    X
    Beiträge
    2.050
    Hallo nochmal!

    Nach halbjähriger Testphase will ich jetzt mal meine Optimallösung vorstellen, diese besteht aus den Scripts, die ich geschrieben habe + Alfred. Mit Alfred ist es möglich AppleScripts direkt und schnell auszuführen. Ich habe auch verschiedene Programme getestet, die mich nicht zufriedenstellten, sowohl vom Preis, als auch von der Funktionalität. Eine App, die insbesondere alle aktiven Fenster anordnet (Arrangement Script), gibt es wohl nicht.

    Ich hab mal wieder ein paar Videos zur Veranschaulichung gemacht:



    Ich hab sie in 2 Kategorien geordnet. Wer sich die Skripte mal anschauen will, hier sind sie:



    Für Verbesserungsvorschläge und Fehler bin ich natürlich immer offen. Es gibt einige Programme, die "rumzicken".

    Grußbrush
    It's more fun to be a pirate than to join the navy.

Seite 2 von 2 ErsteErste 12

Stichworte

Berechtigungen

  • Neue Themen erstellen: Nein
  • Themen beantworten: Nein
  • Anhänge hochladen: Nein
  • Beiträge bearbeiten: Nein
  •