0
votes

Anyway to get AutoHotkey to pop the Power Users Menu in Windows 8.1? Typically accessed via Win+X. I can get AHK to perform other Windows key based key combinations, such as Win+D, but the Win+X refuses. I have several other AHK scripts that work fine, all UAC issues have been eliminated. I have tried 'Send, {LWin Down} x {LWin Up}', 'Send, #x', changing SendMode to all various modes had no effect. Running the AHK script as Admin had no effect, not surprisingly since I am running as Administrator and I have UAC turned completely off.

You may ask why I want to do this. The reason is I want access to the 'Shutdown or sign out' menu, so I can trigger either restart or shutdown. This is so I can use an AHK to trigger my machine to restart or shutdown (laptop). I am doing this, because what I had been using previous to Win 8.1 stopped working, which was was, for example to shut down, 'Shutdown, 9'. The computer shuts down, but then starts back up, totally strange. When I use the Win+X menu, or Start8 (highly recommended) it works fine, and stays off. I even tried skipping AHK and was via my MS keyboard able to trigger a command-line one liner of 'Shutdown -s -f -t 00' which behaves the same as the AHKs attempt at shutting my computer down. And to review, the Win+X and Start8 shutdown options work fine.

So far this is WAY more work than it should be to trigger a shutdown from a button on my keyboard!

Any help is much appreciated.

EDIT: Example code was requested, please find the AutoHotkey Script shown below, as described the Power Users Menu does not appear.

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Play  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

MsgBox, 4097, , ---------- The system will restart in 5 seconds. ----------, 5
IfMsgBox Timeout
{
;Shutdown will continue
}
else IfMsgBox Cancel
{
  MsgBox Shutdown canceled.
  return
}

;Does not work
;Send {LWin Down} x {LWin Up}

;Does not work
Send, #x
1
Can you post some code please? I know it seems simple, but if you post code then others will try it and test it for you on their windows 8 systems (I have windows 7, so I can only make abstract guesses for you).bgmCoder

1 Answers

0
votes

Maybe there is some other program that uses win+X. If another program assigns it's hotkey after your script runs, it is possible that it can hijack the hotkey.

Also, I don't know about windows 8, but in XP you could assign a hotkey to a shortcut, and there isn't any way to figure out which shortcut it belongs to. I found this out the hard way when I installed a certaing program and that app's installer set a hotkey to the shortcut - I couldn't get it to go away. I finally tracked it down. Could you have a similar issue?

Also, if you use this, does it work? It is a good test for you.

#x::
msgbox, Hey, Bob!
return

If that works, then it may be an issue with whether win+X can be (or is being) accepted by the active program.