Controlling Windows 10 from Hotkeys (or Buttons)

I want to use Directory Opus for my hotkey manager. I really don't want AHK, etc. too as I'm paying for Directory Opus now. I went the script route because it doesn't seem like any Windows "commands" are built in yet like other hotkey tools.

My issue is I can't seem to get System level commands to work. As an example, I want to set a hotkey in Directory Opus to open the Windows 10 Search box ({WIN}+{Q}).

I have a script attached to a hotkey, but can't figure out how to get it to work. I figured SendKeys, but the script always fails.

Has anyone else done these kind of things?

If you have option explicit at the top of a VBScript then you need to declare any variables you use before using them.

i.e. Add a line with dim WshShell before the line with Set WshShell = ...

OMG. Having spent the majority of my career as a developer and software architect this is embarrassing. Haven't used VB / VBScript in so long I just missed that. Dur.

2 Likes

I wound up switching it to JScript, but got it working. WScript's SendKeys doesn't seem to have ability to send the {WIN} key, but this version is good enough.

function OnClick(clickData)
{
    var oShell = new ActiveXObject("WScript.Shell");
    oShell.SendKeys("^{ESC}");
}