Page 1 of 1
Setting Up Context-Sensitive Keyboard Shortcuts
Posted: 19 Apr 2024 15:45
by SirSocks
Is it possible to create keyboard shortcuts that are only active for specific drives or folders? Some people may refer to this as context-sensitive shortcuts. For example, if I'm using Microsoft OneDrive and I push the 'delete' key, the function would be remapped to "Remove Shortcut". However, if I'm using any other drive/folder the 'delete' key should function as normally intended. How can I set up context-sensitive keyboard shortcuts?
Screenshot of OneDrive highlighting the ''remove shortcut" option.

Re: Setting Up Context-Sensitive Keyboard Shortcuts
Posted: 19 Apr 2024 15:53
by highend
You can't. If you want something like this, do in via e.g. AutoHotkey...
Re: Setting Up Context-Sensitive Keyboard Shortcuts
Posted: 19 Apr 2024 16:02
by SirSocks
highend wrote: ↑19 Apr 2024 15:53
You can't. If you want something like this, do in via e.g. AutoHotkey...
I'm surprised that 'you can't'. I really would've thought that a script may be able to do something like this...
Delete Key -> check if the selected file is in a specific folder and is a shortcut -> if True Remove Shortcut -> if False delete file.
Re: Setting Up Context-Sensitive Keyboard Shortcuts
Posted: 19 Apr 2024 16:12
by highend
You can't assign the delete key to execute a specific script...
Re: Setting Up Context-Sensitive Keyboard Shortcuts
Posted: 19 Apr 2024 16:14
by SirSocks
highend wrote: ↑19 Apr 2024 16:12
You can't assign the delete key to execute a specific script...
Ah, thank you for clarifying

Re: Setting Up Context-Sensitive Keyboard Shortcuts
Posted: 19 Apr 2024 17:44
by MBaas
Eh, sorry highend, but you can! ("Customize kbd shortcuts" supports the Del key and the assignment is effective afterwards!)
Re: Setting Up Context-Sensitive Keyboard Shortcuts
Posted: 19 Apr 2024 17:47
by highend
Oh, you're right. You can't do this directly in the user defined commands but via keyboard shortcuts...
Re: Setting Up Context-Sensitive Keyboard Shortcuts
Posted: 19 Apr 2024 18:00
by MBaas
So I guess the answer to the op's question is then that this functionality would be achievable with scripting.
You could easily set up a script that would check if "<curpath>default_action.xys" existed and then execute it.
Although...I personally do not like that idea - far too much to set this up, especially when you repeatedly want to run existing scripts in other folders.
Maybe if one would tag the folders and ran tag-specific macros.
Re: Setting Up Context-Sensitive Keyboard Shortcuts
Posted: 20 Apr 2024 09:26
by eil
SirSocks wrote: ↑19 Apr 2024 15:45
Is it possible to create keyboard shortcuts that are only active for specific drives or folders? Some people may refer to this as context-sensitive shortcuts. For example, if I'm using Microsoft OneDrive and I push the 'delete' key, the function would be remapped to "Remove Shortcut". However, if I'm using any other drive/folder the 'delete' key should function as normally intended. How can I set up context-sensitive keyboard shortcuts?
Yes you can via scripting, just need to check the location before actually making an action Here 's
an example of script i use for delete with better safe belts, that has different action when location is a paper folder.