• Apfeltalk ändert einen Teil seiner Allgemeinen Geschäftsbedingungen (AGB), das Löschen von Useraccounts betreffend.
    Näheres könnt Ihr hier nachlesen: AGB-Änderung
  • Die Bildungsoffensive hier im Forum geht weiter! Jetzt sollen Kreativität und technische Möglichkeiten einen neue Dimension erreichen. Das Thema in diesem Monat lautet - Verkehrte Welt - Hier geht es lang --> Klick

AppleScript iTunes Party-Jukebox aktualisieren

clemson

Jamba
Registriert
28.08.06
Beiträge
59
Hallo!

Ich möchte gerne per Shortcut in der Party-Jukebox die Playlist aktualieren, habe aber leider keinen Menübefehl gefunden welchem ich ein Tastaturkürzel zuweisen könnte. Deshalb habe ich mir gedacht ich mache das ganze per Applecript - müsste doch möglich sein, oder?

Wie könnte man das realisieren?

Code:
tell application "iTunes"
// was muss hierhin?
end tell

mfg,
ich
 
Ich hab mich ein bisschen in AppleScript eingelesen und endlich ein Script schreiben können welches mit die Part-Jukebox aktualisiert.

Code:
-- set the name of the playlist which shall be refreshed
set partyJukeboxPlaylistName to "Party-Jukebox"
tell application "iTunes"
	-- get a reference to playing or selected track
	if selection is not {} then
		set theTrack to (item 1 of selection)
	else if player state is not stopped then
		set theTrack to current track
	else
		display dialog "Nothing is playing or selected." buttons {"Cancel"} ¬
			default button 1 with icon 0
	end if
	
	-- get a list of all tracks in the playlist
	set playlist_tracks to tracks in (first playlist whose name is partyJukeboxPlaylistName)
	
	-- get the index of the current selected/playing item
	repeat with i from 1 to number of items in playlist_tracks
		set this_item to item i of playlist_tracks
		if this_item is theTrack then
			set theTrackIndex to i
		end if
	end repeat
	
	-- delete all items after the current track
	repeat with i from theTrackIndex + 1 to number of items in playlist_tracks
		set this_item to item i of playlist_tracks
		delete this_item
	end repeat
end tell
end