iTunes Window Resize via Applescript + Xcode Frage

franky83

Aktives Mitglied
Thread Starter
Dabei seit
05.12.2007
Beiträge
563
Reaktionspunkte
35
1)
Hallo, habe mir mal ein kleines Script zusammengeschustert um iTunes zu resizen in Abhängigkeit ob ein externer Monitor angeschlossen ist oder nicht.

Code:
property DockHeight : 100
property menuebar : 22
property LCDwidth : 1680
property LCDheight : 1050
property MACheight : 800
property MACwidth : 1280


tell application "Finder"
	
	set Workspace to bounds of window of desktop
	set WSwidth to item 3 of Workspace as string
	set WSheight to item 4 of Workspace as string
	
	if (((WSwidth - MACwidth) > 0) and ((WSheight - MACheight) > 0)) then
		my resize("LCD")
	else
		my resize("MAC")
	end if
	
end tell


on resize(Monitor)
	
	tell application "System Events"
		--set FrontApplication to (get name of every process whose frontmost is true) as string	
		
		tell process "iTunes"
			if (Monitor is "LCD") then
				
				set currentSize to size of window 1
				set currentW to item 1 of currentSize
				set currentH to item 2 of currentSize
				
				if (currentW < MACwidth) then
					
					set position of window 1 to {(LCDwidth - MACwidth) / 2, (LCDheight - MACheight) / 2}
					set size of window 1 to {MACwidth, MACheight}
					
				else if (currentW ≥ MACwidth) then
					if (currentW < LCDwidth) then
						
						set position of window 1 to {0, menuebar}
						set size of window 1 to {LCDwidth, (LCDheight - menuebar - DockHeight)}
						
					end if
					
				else if (currentW = LCDwidth) then
					if (currentH = LCDheight) then
						
						set position of window 1 to {(LCDwidth - MACwidth) / 2, (LCDheight - MACheight) / 2}
						set size of window 1 to {MACwidth, MACheight}
						
					else if (currentH ≠ LCDheight) then
						
						set position of window 1 to {0, menuebar}
						set size of window 1 to {LCDwidth, (LCDheight - menuebar - DockHeight)}
						
					end if
				end if
				
			else if (Monitor is "MAC") then
				
				set position of window 1 to {0, menuebar}
				set size of window 1 to {MACwidth, (MACheight - menuebar - DockHeight)}
				
			end if
		end tell
	end tell
	
end resize


Wenn ich das Script im Scripteditor ausführe, klappt es wunderbar aber sobald ich es in iTunes ausführen möchte, bekomme ich die Meldung Bild 1.png

2)
Gibt es eine Möglichkeit wenn ich in Interface Builder eine Combo Box einfüge, die Items über eine externe Datei zu verändern?
 
Zuletzt bearbeitet:
Zurück
Oben Unten