getting file with slightly different name

  1. I am trying to automate retrieving music selections from our server.
  2. I have written some applescript code that gets me started. see below.
  3. the catch is this… there are 300+ CD’s in the library.

if the user inputs AM054_3 in the dialog box, I will need to get the file from its source location (on another drive but I have the drive mounted), even if the name is a little different in its folder, and copy it to the destination which I have already declared (“dest_loc”).

  • The source location folder might have 54 CD’s that start with AM
  • some CD’s use AM054_03.mp3 as a naming convention, some use AM023_1.mp3 as a naming convention. The user will not get it right so I have

I would have to match the name input in the dialog box with the exact file name

HOW CAN I DO THIS…
THE WHOSE CLAUSE? “…a file whose name contains AM054_3”
THE REPEAT FUNCTION?
Any help getting this to go will be one small step for this man.
thanks in advance.

tell application "Finder"
	--this is the location of the app
	--anywhere you open the app from, 
	--will point the music cuts there
	set dest_loc to path to me
	
	--differentiates one cut from another
	--based on a comma
	set AppleScript's text item delimiters to ","
	
	--this brings up a dialog box for user to put in
	--CD information.......in this format
	--CD#_cut#    (ie  AM054_09)
	set Song_Prompt to display dialog "Enter music selections like this
(commas after each selection)
(no comma after last selection):" default answer "AM054_3,chap123_5,evo009_23,OMACU_21

"
	
	--this returns the list of songs entered
	set songlist to text returned of Song_Prompt
	
	
	--this counts the number of songs needed
	set songcount to length of text items of songlist
	
	display dialog songcount as string
	
	--mount music folder as virtual Disk
	mount volume "smb://111.2.3.444/musicfolder"
	
	--get each song needed and copy to source folder
	set files_copied to 0
	set j to 1
	repeat until files_copied = songcount
		display dialog "files_copied " & j
		set files_copied to files_copied + 1
		set j to j + 1 as string
	end repeat
	
end tell

Are all the mp3 tracks in stable locations? What I mean is, are the files moved around a lot, or are they left in the same folders all the time? How often is new music added to the system?

What do you mean by CDs? If all the tracks are on a hard drive somewhere, they should be in folders. Are the folders named after the CD names?

As long as the files are not moved around all the time, it would not be terribly difficult to create a database file with all the track names and locations. The user could choose the track name(s) after entering the desired search parameter, and the database would have the exact pointer of where to find the file, and transfer it to the destination.

Is that sort of what you had in mind?

casdvm