iTunes Dateien in der Playlist durchnummerieren

A

Acronis

Aktives Mitglied
Thread Starter
Dabei seit
26.01.2005
Beiträge
163
Reaktionspunkte
3
Hallo,

das untenstehende Script kann die Songnamen durchnummerieren, aber ich hätte gerne, dass er den Dateinamen durchnummeriert.

Was muss ich im Script ändern?

Code:
(* "Number Tracks of Playlist" for iTunes 2 
written by Doug Adams 
dougadams@mac.com

Get more free AppleScripts and info on writing your own
at Doug's AppleScripts for iTunes and SoundJam
http://www.malcolmadams.com/itunes/ *)
-------------------------------------
global thePlaylist, extra_blurb, extra_blurb
(*
The text between quotes in
the line below is what appears
between the number of the track
and the actual title.
If you like, you may change 
the character within quotes below
to another separator .
If you want no separator, leave the quotes
empty, like so: ""
Then just  "Save" the script.
*)

set separator to "."
--------------------------------------

tell application "iTunes"
	set thePlaylist to (get view of front window)
	set first_track to 1
	
	set extra_blurb to "selected Playlist:"
	copy (my setFirstNum()) to trackOffset
	
	--go for it
	--initialize counters and figgerin' stuff
	set last_track to (get index of last track of thePlaylist)
	copy (last_track + trackOffset) as string to last_digit
	set len_last_digit to (get count of characters of last_digit)
	
	repeat with i from first_track to last_track
		--pad with zeroes
		set zeroStr to ((i + trackOffset) as string)
		repeat while length of zeroStr is less than len_last_digit
			copy "0" & zeroStr to zeroStr
		end repeat
		set name of track i of thePlaylist to zeroStr & separator & (get name of track i of thePlaylist as string)
	end repeat
	--	display dialog "Finished!" buttons {"Thanks"} default button 1 with icon 1
	
	(* You can put this line back in, but if you do, it may cause a delay in re-drawing the iTunes screen in OS X.
	This is a known issue *)
end tell

on setFirstNum()
	try
		copy (text returned of (display dialog "Number every track of the " & extra_blurb & return & return & ¬
			"  " & "\"" & (get name of thePlaylist as string) & "\"" & return & return & ¬
			"starting with the number:" default answer "1") as number) - 1 to trackOffset
	on error
		my setFirstNum()
	end try
	
end setFirstNum
 
Hallo,

wie Du es in Dein Script implementierst überlasse ich Dir :)

Die Nummerierung würde ich wie folgt vornehmen:

- Schleife, die die List bzw. Selection durchgeht
- Variable die immer um eins erhöht wird

dann:

Code:
set ZAEHLER to 1

repeat with naechterTrack in sel
    set pfadZurDatei to location of naechterTrack
    set the name of file pfadZurDatei to ZAEHLER & DerNameDenDuWillst
    set ZAEHLER to ZAEHLER + 1
end repeat

Viel Spass beim probieren!

Viele Grüße
 
Danke für die Antwort!

Ich habe jetzt mal versucht selbst etwas zu basteln, aber er macht überhaupt nix. Wo liegt der Fehler?
Ich versteh irgendwie die Variable naechterTrack nicht. Woher soll er denn wissen, welcher der nächste Titel ist?
Er mag irgendwie of thePlaylist nicht. Er erwartet in???



Code:
tell application "iTunes"
	set thePlaylist to (get view of front window)
	--	set first_track to 1
	--	set last_track to (get index of last track of thePlaylist)
	set zaehler to 1
	set separator to "."
	
	repeat with naechterTrack in thePlaylist
		set track_name to (get name of current track)
		set pfadZurDatei to location of naechterTrack
		set the name of file pfadZurDatei to zaehler & separator & track_name
		set zaehler to zaehler + 1
	end repeat
	
end tell
 
Hallo,

die Lösung lautet:

Code:
tell application "iTunes"
	--hier wird Deine Liste der makierten Tracks erfasst
	set sel to selection
	
	set zaehler to 1
	set separator to "."
	
	repeat with naechterTrack in sel
		--erfaßt den Namen des Tracks aus dem ID3-Tag
		set track_name to name of naechterTrack as string
		set pfadZurDatei to location of naechterTrack
		
		tell application "Finder"
			set zaehlerString to zaehler as string
			set trackTypSuffix to (get name extension of pfadZurDatei) as string
try			
set the name of file pfadZurDatei to zaehlerString & separator & track_name & "." & trackTypSuffix
end try
		end tell
		
		set zaehler to zaehler + 1
	end repeat
	
end tell

Beachte:
Das Skript ist nun so, dass du zuvor die bestimmten Tracks makieren mußt (oder Apfel + A). Alles auf einmal ist immer gefährlich!
Das Skript habe ich geprüft und funktioniert.

Viele Grüße und viel Erfolg
 
Hi little_pixel,

Danke!!! Es funktioniert... :dance:

Mein Ansatz ist ja weit davon entfernt... Nochmal vielen Dank für deine Mühe!!!

Danke Gruß
 
Zurück
Oben Unten