Can I override a hotkey if running an app as administrator?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys

User avatar
DevWithCoffee
Posts: 54
Joined: 13 Oct 2020, 12:16

Re: Can I override a hotkey if running an app as administrator?

Post by DevWithCoffee » 03 Feb 2023, 15:30

If this APP is the Script itself:

Code: Select all

if(A_IsAdmin <> 0)
{
	Hotkey, F2 , MyLabel
}
Check other applaction run as admin:
viewtopic.php?p=40388#p40388

gmoises
Posts: 74
Joined: 18 Nov 2017, 16:43

Re: Can I override a hotkey if running an app as administrator?

Post by gmoises » 03 Feb 2023, 17:31

When run this code as a regular user, F1 and F2 work
When run this code as Admin, F1 does not work and F2 does work
Exactly as expected

#If [Expression]
Creates context-sensitive hotkeys and hotstrings. Such hotkeys perform a different action (or none at all) depending on the result of an expression.

Code: Select all

#Requires AutoHotkey v1.1.36+
#If !A_IsAdmin
; here all the code for NOT A_IsAdmin
F1::MsgBox % A_IsAdmin ? "Admin" : "NOT Admin"

#If
; here all the code without restriction
F2::MsgBox % A_IsAdmin ? "Admin" : "NOT Admin"

Post Reply

Return to “Ask for Help (v1)”