Closing Config & View window using keyboard shortcuts

Dear All

KNIME allows you to open node the dialog box using F6 and run it by holding shift+enter.

Opening the view can be done using F10 and opening the 1st port view is shift+F6.

My question is how can you close these windows using a keyboard shortcut? 

Ctrl+F4 and Ctrl+W do not work.   

Ste

Alt+F4 probably, or the shortcut you set for closing windows. (Sometimes the dialogs can be closed using Esc too.) Maybe I misunderstand your question.

Cheers, gabor

Sorry for warming this up, but I couldn’t find any forum entries dealing with closing output tables.

So, Alt+F4 works fine. Unfortunately it is not listed as a command in Preferences → General → Keys, where I could change it to something different.

Am I just blind or is there really no opposite command for “Open first out-port view”? :wink:

@gentile , Alt+F4 is the Windows shortcut. So, works across all applications.

1 Like

The configuration popup window can be closed with esc, while the out-port window can not be closed, to close with alt-f4 the focus should be set on the out-port window, i.e move from keyboard back to mouse.
I use shortcuts f6 to configure, f7 to run, and f8 to show results, It would be nice to close both configuration and out-port view using esc for rapid configure-run-display flow.

Hi @ublien and @gentile

If there is no shortcut key setting available to close a viewport (other than the standard Windows Alt-F4), there is possibly an alternative solution.

There is a free application “AutoHotKey” available from autohotkey.com and a script could be written that would remap the Esc key to Alt-F4 if KNIME is the active application.

View ports all get given different windows titles (depending on the node) and KNIME is java-based and so there is limited native-windows information available to AutoHotKey in terms of identifying if the current window is in fact a View Port, but I have only been able to check the the current active isn’t titled “KNIME Analytics Platform” (as we don’t want random presses of Esc shutting down KNIME all the time :wink:

What this means is that any KNIME dialog would be closed if the Esc key is pressed, which may be acceptable but I don’t know for sure that this won’t cause problems.

Anyway the AHK script to achieve this is:

/* Auto Hot Key script to remap Esc into Alt-F4 in KNIME.exe
  Gives the user the ability to remap a key Esc in this example) to work as the standard Close Window key

 Script written by @takbb Brian Bates - 20 Nov 2021
 This script is free to use for any use
 Use at your own risk!

 To use this script, install AutoHotKey - available from autohotkey.com
 Place it in same folder as a copy of AutoHotKey.exe
 rename AutoHotKey.exe as KnimeRemapEscToAltF4.exe  
(i.e. the same name as this script, but with .exe extension)

Ensure that both 

	KnimeRemapEscToAltF4.exe
	KnimeRemapEscToAltF4.ahk

are in the same folder, then run KnimeRemapEscToAltF4.exe

Run either at Windows Startup, or manually run it when you are running Knime.exe
*/

;TrayTip, AutoHotKey, Looking for KNIME Analytics Platform - Esc->AltF4 Remap , 16
SetTitleMatchMode  3 ; window title equals
loop {
  #IfWinActive ahk_exe knime.exe 
  
  ; specify the Key to be remapped here. 
  ; for list of keys see AutoHotKey help at https://www.autohotkey.com/docs/Hotkeys.htm 
  Esc::

  ; if hotkey has been pressed, get the current active window title as we only want to turn the key
  ; into Alt-F4  !{F4} in autohotkey terminology, if it isn't the main KNIME window that is active
  ; Unfortunately all viewports in KNIME have different window titles so we cannot easily do this based
  ; on it only being a viewport window, or config window

  WinGetActiveTitle, Title
  activeTitle=%Title%
 
  if (activeTitle != "KNIME Analytics Platform")
  {
	  ; only convert Esc to F4 if the current active window is not the Main KNIME application window
        Send !{F4}
  }
  return
}

Instructions are basically this:
(1) download and install AutoHotKey

(2) Copy the above script into notepad and save the file to a folder as
KnimeRemapEscToAltF4.txt

(3) Rename it to KnimeRemapEscToAltF4.ahk

(4) From your autohotkey installation folder (probably C:\Program Files\AutoHotkey), copy the AutoHotKey exe appropriate to your windows system (probably AutoHotkey.exe) into the same folder as your KnimeRemapEscToAltF4.ahk file.

(5) Rename the AutoHotKey exe in this folder as
KnimeRemapEscToAltF4.exe
Make sure you have “File name extensions” visible, so that you don’t end up with a file called KnimeRemapEscToAltF4.ahk.txt. It should look like this
image

(6) Run KnimeRemapEscToAltF4.exe

(7) Open a viewport in KNIME.

(8) Press “Esc”

(9) Enjoy!

5 Likes

@takbb Thank you for putting this together. Works like a charm!

3 Likes

You’re welcome @gentile. Glad to hear it works for you. I’ll use it myself too! :slightly_smiling_face:

(I just realised that in my previous message I mis-typed @ubilen who may also be interested.)

2 Likes