I on't like to drive the Finder so I made a few changes to drive System Events.
on run
set fileExtensions to {"mkv", "mp4"}
tell application "System Events"
set origen to files of folder "WINOSX:TV SERIES:"
try
repeat with subtitle in origen
if name extension of subtitle is "srt" then exit repeat
end repeat
repeat with episode in origen
if name extension of episode is in fileExtensions then
set episodename to name of episode
set episodenameNoExtension to (text 1 thru -5 in episodename)
if name of subtitle contains (text 1 thru 7 in episodename) then
set the name of subtitle to episodenameNoExtension & ".srt"
end if
end if
end repeat
end try
end tell
end run
Yvan KOENIG (VALLAURIS, France) lundi 1 avril 2013 20:31:21