diff --git a/Hammerer.ahk b/Hammerer.ahk index 50da791..b62c51e 100644 --- a/Hammerer.ahk +++ b/Hammerer.ahk @@ -1,6 +1,8 @@ SendMode Input Menu, Tray, Icon, shell32.dll, 166 +; 2020-02-06 - added privilege elevation +GoSub, RunAdmin f9:: Gosub, ShowGui @@ -148,5 +150,27 @@ ShowGui: Gui, Add, Button, x5 y%yPos% w495 gButtonApply, Apply LanguageList and EntryOrder yPos += 30 - Gui, Show, h%yPos% w505, [Hammerer] 2018-06-05 j.tretter@accenture.com + Gui, Show, h%yPos% w505, [Hammerer] version 2020-02-06 joe.tretter@kcc.com return + +; Run as admin +RunAdmin: +If !A_IsAdmin + { + if A_OSVersion not in WIN_2003,WIN_XP,WIN_2000 + { + Run % "*RunAs " DllCall( "GetCommandLineW", "Str" ),, UseErrorLevel + if !ErrorLevel + ExitApp + } + MsgBox 0x31, Hammerer, + (LTrim Join`s + Hammere is running as a limited user. If you continue, + it will most likely not be able to interact with CAS Modeler. + `n + To continue anyway, click OK. Otherwise click Cancel. + ) + IfMsgBox, Cancel + ExitApp + } +Return \ No newline at end of file