Delete ALL characters, BUT "n" to the right/left (Help Needed)

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

MacDream

New member
Joined
May 11, 2006
Messages
7
Points
0
Hi everybody,

I'm putting an extensive library of audio files from WW2 times in my iTunes.
Unfortunately they are not properly labeled.
They have the date, which is key in the organization of this files, attached to the Artist name.
I wish I could automate the deletion of "all" character preserving "N" number of them to the left or the right of the string.
This way I would be able to delete everything, but the part of the string I want to preserve. In this case I will preserve the date and delete the artist name, which the number of characters is variable. I'm sure it will be helpful to clean many other scrambled information that comes embedded in audio files.

Could somebody please help me with a script for Itunes to get this job done?

Thanks a lot,
MacDream

P.S.:I submitted a thread on 07/07/2008 with images and links to make myself clear without problems.
Now (03/21/2009) I'm trying to illustrate my request the same way as before, but when I try to post them the site says:
"The following errors occurred when this message was submitted:
1. New members are not permitted to post images or links."

What is going on? This is a problem with cookies?
This is backward!
 

S2_Mac

New member
Joined
Oct 24, 2006
Messages
4,878
Points
0
Location
About 3 feet in front of the monitor
To block out spammers and other ne'er-do-wells, board users can't post links until they exceed 10 posts; until then you can fake it (such as www dot ilounge dot com.)

If you're using a Mac, check out Doug's Applescripts for iTunes -- find the script that comes closest to meeting your needs, and post again if you need it tweaked a bit.
 

MacDream

New member
Joined
May 11, 2006
Messages
7
Points
0
Hi S2_MAC,

I already have browsed in Doug's Apple Scripts and there is nothing specific to carry out this task.
The closest would be "Remove n Characters From Front or Back v3.0", but in my case would be the opposite. Something like: "LIVE "n" Characters at the front or back".
It all depends on how you look at it. As I stated in the title of the thread: "Delete ALL characters, BUT "n" to the right/left" .
I can hack minors things in these scripts as I did with the ' - "Artis-Name" Corrector' script, from which I made a variation to work like this: ' / "Artist/Name" Corrector'. That one was easy, but I don't know the language of the scripts. I don't know the instruction repertory. So I won't be able to create the one I need by myself.
Could you or one of your colleges give me a hand with this please?

Thank you,
MacDream

Illustration here: h t t p : //img*skitch*com/20090322-th2jj84b84sqea5p663bs4bgrn*jpg
(asterisk are dots)

P.S.: S2_MAC, thank you for helping me with my previous post about "Movie size to Comment". I still use it a lot and it's been very helpful.
 

S2_Mac

New member
Joined
Oct 24, 2006
Messages
4,878
Points
0
Location
About 3 feet in front of the monitor
Here's the "Remove n Characters" script modded to "Leave 'N' Characters", for track Names only:
Code:
property my_title : "Leave 'N' Characters"

tell application "iTunes"
	if selection is not {} then
		set sel to selection
	else
		display dialog return & "You must select some tracks first..." buttons {"Cancel"} default button 1 with icon 2 with title my_title giving up after 15
	end if
	
	set {this_offset, myEnd} to my get_a_number("")
	
	set oldfi to fixed indexing
	set fixed indexing to true
	with timeout of 30000 seconds
		repeat with aTrack in sel
			tell aTrack
				if myEnd is "Front" then -- leave characters at front end
					try
						set name to text 1 thru this_offset of (get name)
					end try
				else -- leave characters at back end
					try
						set name to text (0 - this_offset) thru -1 of (get name)
						--set name to reverse of (items 1 thru this_offset of (reverse of text items of (get name))) as text -- same result, only sillier ;-)
					end try
				end if
			end tell
		end repeat
	end timeout
	set fixed indexing to oldfi
	
	try
		if frontmost is true then display dialog return & "Done!" buttons {"Thanks"} ¬
			default button 1 with icon 1 with title my_title giving up after 15
	end try
	
end tell

to get_a_number(addenda)
	-- remove "default button 2" to make no button preferred
	tell application "iTunes" to set opts to (display dialog "" & addenda & "Enter the number of characters to *leave* in the Name tag of the selected tracks, then click the appropriate \"Front\" or \"Back\" button:" default answer "" buttons {"Cancel", "Front", "Back"} default button 2 with title my_title)
	set myNumber to text returned of opts
	set myEnd to button returned of opts
	try
		(myNumber as integer)
	on error
		get_a_number("Enter only numbers..." & return & return)
	end try
	return {myNumber, myEnd}
end get_a_number
 

MacDream

New member
Joined
May 11, 2006
Messages
7
Points
0
Thank you very much S2_MAC!
You are a genius.
You really made my day.
Without this script I would have to modify hundreds of tracks manually in the first batch only.
I also managed to make a mod of the scrip to modify the "Artist" field.

Thanks again and have a nice week,

:) MacDream
 
Top