About Hotkey Handling Problems

I have made dopus my default explorer for hotkey handling issues and have to check a lot of files every day. dopus gives me a lot of convenience. I set the Space hotkey as the trigger key, hoping to achieve the selected file if the file can be previewed, open a separate preview window, if the file can not be previewed open the file by default, if the file does not have the default open mode or is an unknown file type open the file with a text viewer. Can anyone provide an example of JS script?

You could have something which ran different commands depending in the file extension.

(File Type Groups also let you test for things like “is this extension an image” without having to list all the Image extensions in the code.)

But there’s no way to know ahead of time if a file will be displayed in the viewer. (In fact, if shell icons or hex view are enabled, all files are technically viewable.) Even Opus itself can’t known that as it may depend on what a third party preview handler (e.g. for PDF) thinks about a particular file.

The default spacebar behaviour is also imported for keyboard multi-selection, so I’d recommend using a different hotkey if you can get used to it.

All right, thanks. Excludes judging whether the file can be previewed independently. If the file is an executable file, press the hot key to open it directly in the default opening mode. If the file does not have the default opening mode or the file type is unknown, press the hot key to open it using the text viewer. Is there any example that can be referred to