Delete file extension..please help

Hi everyone,

Basically I work for a reprograohics company who deal with a large amount of EPS files. One of clients insists on having files sent to them WITHOUT the .eps file extension. Our I.T department made an apple script for us that allowed us to drop numerous files or a folder onto the droplet and the .eps was removed. This saved us so much time and was used constantly. I have just been given a new iMac with 10.4.7 on and the script no longer works. I DO NOT HAVE A CLUE when it comes to applescript and the I.T department are away for a week!
I would be very grateful if someone could look at the script below and amend where possible…

Thanks again.
Lee

-- This droplet processes both files or folders of files dropped onto the applet
on open these_items
	repeat with i from 1 to the count of these_items
		set this_item to (item i of these_items) as text
		set the item_info to info for alias this_item
		if folder of the item_info is true then
			process_folder(this_item)
		else
			process_item(this_item)
		end if
	end repeat
	tell application "Finder"
		display dialog "All necessary files have been renamed." buttons {"OK"} default button 1 with icon 1
	end tell
end open

-- this sub-routine processes folders
on process_folder(this_folder)
	set this_folder to this_folder as text
	set these_items to list folder alias this_folder without invisibles
	repeat with i from 1 to the count of these_items
		set this_item to (this_folder & (item i of these_items))
		set the item_info to info for alias this_item
		if folder of the item_info is true then
			set this_item to this_item & ":"
			process_folder(this_item)
		else if (alias of the item_info is false) then
			process_item(this_item)
		end if
	end repeat
	
end process_folder

-- this sub-routine processes files
on process_item(this_item)
	
	set the text_to_trim to ".eps"
	set the character_count to the number of characters of the text_to_trim
	set item_info to info for alias this_item
	set this_text to name of item_info as text
	
	if the this_text ends with the text_to_trim then
		set the new_name to (characters 1 thru -(the character_count + 1) of the this_text) as text
		--display dialog new_name
		--set_item_name(this_item, new_name)
	end if
	tell application "Finder"
		select file this_item
		set name of selection to new_name
	end tell
end process_item

“No longer works” is a little vague - :confused:

Can you tell us what does happen - do you get a message?

I think this will work for you:

-- This droplet processes both files or folders of files dropped onto the applet
on open these_items
	repeat with i from 1 to the count of these_items
		set this_item to (item i of these_items) as text
		set the item_info to info for alias this_item
		if folder of the item_info is true then
			process_folder(this_item)
		else
			process_item(this_item)
		end if
	end repeat
	tell application "Finder"
		display dialog "All necessary files have been renamed." buttons {"OK"} default button 1 with icon 1
	end tell
end open

-- this sub-routine processes folders
on process_folder(this_folder)
	set this_folder to this_folder as text
	set these_items to list folder alias this_folder without invisibles
	repeat with i from 1 to the count of these_items
		set this_item to (this_folder & (item i of these_items))
		set the item_info to info for alias this_item
		if folder of the item_info is true then
			set this_item to this_item & ":"
			process_folder(this_item)
		else if (alias of the item_info is false) then
			process_item(this_item)
		end if
	end repeat
	
end process_folder

-- this sub-routine processes files
on process_item(this_item)
	
	set the text_to_trim to ".eps"
	set the character_count to the number of characters of the text_to_trim
	set item_info to info for alias this_item
	set this_text to name of item_info as text
	
	if the this_text ends with the text_to_trim then
		set the new_name to (characters 1 thru -(the character_count + 1) of the this_text) as text
		--display dialog new_name
		--set_item_name(this_item, new_name)
	end if
	tell application "Finder" to tell file this_item to set name to new_name -- Changed this line
end process_item

POSTSCRIPT: the OP informed me by PM that this worked for him. Problem solved! (Note that I did not attempt to “clean” this code up lest his IT person not know what I’d done.)