AHK Script to Click a Run As Admin program in Taskbar

MilesAhead

Eclectician
VIP Member
Pro User
Messages
2,130
I have UAC set to not notify me on my W8 system. If I have a shortcut with Compatibility set to Run As Administrator and put it in the StartUp Folder, it will not be run. I really don't like to use Task Scheduler for anything. Since I do use AHK and it is a macro programming language I thought, Duh! Why not just make a program to click the Taskbar Icon of the shortcut?

Actually if you have 3 or 4 programs you want to run in the System Tray and they need to be Run As Administrator you could add them. For it to work you need to use the WinSpy that comes with AHK to get the x y coords of the Taskbar Icon you want to click. Also you need to make sure its position will not change. You can adjust the Sleep delay inside the program so that all icons have finished loading to avoid the position shifting. Also you need to make sure your system comes up without any windows open that may block the mouse clicks.

In this program I use a Message Box with a 10 second delay to give the option not to click the Taskbar Icon. Edit this program to your needs and put a shortcut to it in the StartUp Folder to click start your programs. You will need to install the AutoHotkey suite to compile it to exe.

In the code below I use it to click the Taskbar icon for ReRun.exe. Change the MsgBox text to suit your needs. Also it helps if you always run with the same screen resolution. :)

Code:
SendMode Input
CoordMode,Mouse,Screen
Sleep 30000  ; 30 second delay to let icons load
MsgBox, 4388, ClickReRun, Click on ReRun in Taskbar to run it?, 10
IfMsgBox No
    Exit
Click,356,751
Exit
 
Last edited:

My Computer

System One

  • OS
    Windows 8.0 x64
    Computer type
    Laptop
    System Manufacturer/Model
    Toshiba Satelite C55D-A Laptop
    CPU
    AMD EI 1200
    Memory
    4 gb DDR3
    Graphics Card(s)
    Raedon 340 MB dedicated Ram
    Monitor(s) Displays
    Built in
    Screen Resolution
    1366 x 768
    Hard Drives
    640 GB (spinner) Sata II
    Keyboard
    Built in
    Mouse
    Touch pad
Back
Top