Anyway to obtain list of Application that can open a file via Terminal? offered a JavaScript which no longer works on macOS 13.1 Ventura. Has anyone updated this script or have a different one?
#!/bin/bash
whatOpens() {
osascript -l JavaScript <<OSA
ObjC.import('CoreServices');
ObjC.deepUnwrap(
$.LSCopyAllRoleHandlersForContentType(
"$1",
$.kLSRolesAll
)
).map(x=>Application(x).name())
.join('\n');
OSA
}
whatOpens "$1"
05:50:10 ~/desktop :whatOpens public.text
execution error: Error: TypeError: undefined is not a function (near '...).map(x=>Application(x).n...') (-2700)
05:53:31 ~/desktop :