2 dragged files, different extensions, copy name from one to the other

I do this manually over and over and over again.

I have 2 files that are different file types (tif and fts). I want to drag them both, together, onto an Applescript and the script to set then name of the fts file to the same name as the tif file).

Can anyone help me with how to do this? I’ve tried making something in Automator, but I haven’t managed.


Try this:

on open fileList
	set {fileTif, fileFts} to fileList
	if (fileTif as text) ends with ".fts" then
		set {fileTif, fileFts} to {fileFts, fileTif}
	end if
	set tifPath to fileTif as text
	set ftsPath to fileFts as text
	set saveTID to AppleScript's text item delimiters
	set AppleScript's text item delimiters to {":"}
	set theName to text item -1 of tifPath
	set AppleScript's text item delimiters to saveTID
	set newName to text 1 thru -5 of theName & ".fts"
	tell application "System Events"
		set name of file ftsPath to newName
	end tell
end open

Hi Shane,


Thank you so much.

As I thought would be the case, reading your script, I can’t even understand what it’s doing, so I could never have hoped to achieve this on my own, well, not without a couple of years of learning anyway. :slight_smile: It’s fast and efficient and will be a pleasure every time I use it. :slight_smile: