An automator service that opens a file with the same name but different extension of the selected item

Solution 1:

You don't want to rename the file, just use a new folder path in order to look up a matching file. Automator doesn't include default actions for stuff like that, so you are looking at using a third party action or a script, or doing that part yourself.

For an AppleScript solution, create a new service/quick action workflow that receives files or folders in the Finder, and add a Run AppleScript action, replacing the default script with the following:

on run {input, parameters} -- match name of an input item to a videoFolder item
    set videoFolder to ((path to home folder) as text) & "Movies:Videos:" -- the HFS folder path containing matching video files
    repeat with anItem in the input -- return the first match
        set {theName, theExtension} to getNamePieces from anItem
        tell application "Finder"
            set matches to (files of folder videoFolder whose name starts with theName) -- match any extension
            if matches is not {} then return (first item of matches) as alias
        end tell
    end repeat
    return missing value -- no match
end run

to getNamePieces from someItem -- get name and extension from a file item
    tell application "System Events" to tell disk item (someItem as text)
        set {theName, theExtension} to {name, name extension}
    end tell
    if theExtension is not "" then
        set theName to text 1 thru -((count theExtension) + 2) of theName -- the name part
        set theExtension to "." & theExtension
    end if
    return {theName, theExtension}
end getNamePieces

...then finish up by adding an Open Finder Items action, and save the workflow.