Stop Enter key from opening file

I'm running DO 13.4. Is there some way to prevent the Enter key from opening an AutoHotKey script (extension .ahk) file, so that it can only be opened (i.e. Run) by double-clicking? I would still want to use Enter for opening other files or sets of files.

You can do this by reprogramming the Enter key using Settings / Customize / Keys.

  • Create a new Lister hotkey
  • Set the hotkey to Enter using the dropdown arrow at the right of the hotkey field
  • Set the function as shown:
@ifsel:!type=*.ahk
FileType ACTION=dblclk

Then click OK and OK again to close the Customize dialog.

1 Like

Terrific - thanks very much!

You could also override the Left double-click action for the AHK file type, and make it do something else (e.g. open the file in a text editor). That action is what pushing enter in the file runs.

E.g. I just checked this worked with the .txt file type, and it makes Opus's About dialog open instead of the file when I push enter on it:

It's done via Settings > File Types.

As with Jon's method above, this only affects Opus and not other programs. Enter on the file in another program will still do what it did before.

Is there a method to redefine ENTER in file type definition, so if later the file type will be deleted then the definition of ENTER (specific to the file type) will be deleted along with the file type?

The method I suggest will do that.

Thanks Leo. I was writing my post too long and I missed your reply. :flushed:

1 Like

Thanks Leo. So that would mean using the context menu if one wanted to actually Run the script?

Yes, that would be the easiest way.