on open dropItems tell application "Finder" repeat with anItem in dropItems set theName to name of anItem if theName ends with ".tar.gz" then set name of anItem to my replace(theName, ".tar.gz", ".tgz") else if name of anItem ends with ".tar.bz2" then set name of anItem to my replace(theName, ".tar.bz2", ".tbz") end if end repeat end tell end open to replace(theText, replaceStr1, replaceStr2) set oldDel to AppleScript's text item delimiters set AppleScript's text item delimiters to replaceStr1 set theText to every text item of theText set AppleScript's text item delimiters to replaceStr2 set theText to theText as string set AppleScript's text item delimiters to oldDel return theText end replace