Rename .srt file based on .mkv in same folder

@Leo the JS code works fine within the rename presets. I have tried to place it in a button (following How to use buttons and scripts from this forum - #2 by Leo) by selecting Script Type "JScript" and pasting the code there but no luck. Any special instructions please?