AppleScript - "Close tabs to right of current tab" in Google Chrome
This following AppleScript code should accomplish what you are trying to achieve.
This will close the tabs to the right
try
tell window 1 of application "Google Chrome" to ¬
close (tabs -1 thru (active tab index + 1))
end try
This will close the tabs to the left
try
tell window 1 of application "Google Chrome" to ¬
close (tabs 1 thru (active tab index - 1))
end try
Frame challenge…
I've no idea how to fix the Applescript, sorry, but this seems something of a heavy-handed approach to a function that's already in the menu & can therefore be triggered directly by a simple key command.