What I did with "Remove n Characters"

GO TO ADMIN PANEL > ADD-ONS AND INSTALL VERTIFORO SIDEBAR TO SEE FORUMS AND SIDEBAR

eustacescrubb

New member
Joined
Jan 18, 2002
Messages
2,284
Points
0
Age
45
Website
www.johnpauldavis.org
This script deletes a speicified number of characters from the front of the track's name. This morning I needed it to get rid of stuff in front of an artist name (I wanted to get "Bob Marley W/" off the front of every track's artist name in Chant Down Babylon.) So I initially modified the script to do this, but while I was at it, I thought it'd be useful for me to go ahead and modify it so I could choose between tags I'm likely to edit in the future.

initially, I edited this block of code:

repeat with i from 1 to ix
set thisTrack to item i of theBigList
set thisTracks_name to (get thisTrack's name)
set thisTrack's name to (text (this_many_front_end_characters + 1) thru -1 of thisTracks_name)
end repeat
to look like this:

repeat with i from 1 to ix
set thisTrack to item i of theBigList
set thisTracks_artist to (get thisTrack's artist)
set thisTrack's artist to (text (this_many_front_end_characters + 1) thru -1 of thisTracks_artist)
end repeat
For the final version, I wanted it to allow me to choose between artist, album, and track name, so I added this list to the beginning of the script:

property tagList : {"Name", "Artist", "Album"}
Then, where the block of code above was, I added a prompt to allow the user to choose:

set tagChoice to (choose from list tagList with prompt "Which tag's field would you like to edit?") as string
And finally, told it what do based on how the user chose:

if tagChoice is item 1 of tagList then
repeat with i from 1 to ix
set thisTrack to item i of theBigList
set thisTracks_name to (get thisTrack's name)
set thisTrack's name to (text (this_many_front_end_characters + 1) thru -1 of thisTracks_name)
end repeat
end if
if tagChoice is item 2 of tagList then
repeat with i from 1 to ix
set thisTrack to item i of theBigList
set thisTracks_artist to (get thisTrack's artist)
set thisTrack's artist to (text (this_many_front_end_characters + 1) thru -1 of thisTracks_artist)
end repeat
end if
if tagChoice is item 3 of tagList then
repeat with i from 1 to ix
set thisTrack to item i of theBigList
set thisTracks_album to (get thisTrack's album)
set thisTrack's album to (text (this_many_front_end_characters + 1) thru -1 of thisTracks_album)
end repeat
end if
Works like a champ!
 

thenightfly42

New member
Joined
May 10, 2003
Messages
351
Points
0
Location
New England
I took "Remove n Characters", removed the dialog box so that it would automatically remove 3 characters, and mashed it together with "Albumize Selection", where I also removed the dialog box.

This is because I rip CDs to AIFF, then use AAChoo to encode in Best. Unfortunately, AAChoo loses all of the tag information, so I'm stuck with just the track name. I append the track number to the track name to make sure my imports are in the correct order, then this combined script removes the "03 " and sets "3 of 15".
 
Top