I have a AHK script/application that stays running on the taskbar in the notification area. It contains some hotkeys and functions.
It needs to be running as administrator in order to manipulate the Task Manager.
I can use the following common code snippet to automatically run the script.ahk file as administrator:
Code: Select all
;restart script in admin mode
if not A_IsAdmin
{
Run *RunAs "%A_ScriptFullPath%"
ExitApp
}
I also use the following code to reload the script automatically without showing the reload script confirmation window:
Code: Select all
#SingleInstance Force ; Replaces script if running.
Could not close the previous instance of this script. Keep waiting? Yes|No
I can omit the code snippet "restart script in admin mode" and either: compile the script and set the properties of the application to run as administrator, or create a shortcut to the script.ahk file and set the properties of the shortcut to run as administrator. Both of those work fine and always run as admin and reload the script or application.
But how to make this work by opening the script.ahk file itself? Is it possible?
I just want to be able to double click the script.ahk file, have it show the User Account Control window, click Yes and have it reload the script.
Thanks a lot.