I am writing a script in autohotkey. The purpose of the script is to change the action performed by the program that someone clicks on the taskbar. For Example if someone say triple clicks IE on the taskbar it opens in in private mode. I have some code of this below, my problem is I am trying to find a way to automatically determine the location of the taskbar icons on the taskbar so that the program can set it's bounds for each click. I have tried looking in the registry and I have also tried extracting the icons from the programs and searching for them on screen using imagesearch but it fails to find the icons.... Any way I can accomplish this?
CODE
#NoEnv ; Recommended for performance and compatibility with future
AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
#SingleInstance Force
CoordMode, Mouse, Screen
Time = 500
~Lbutton::
;if there is a double left click
If (A_PriorHotKey = A_ThisHotKey and A_TimeSincePriorHotkey < Time)
{
Count ++
}
Else
{
Count = 1
}
SetTimer, Handler, %Time%
return
Handler:
SetTimer, Handler, Off
IfEqual, Count, 2
{
If (Mouse_y > 1040)
{
If (Mouse_x > 50) and (Mouse_x < 98) ;over my explorer icon
{
Run, "%A_AppData%\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\Internet Explorer.lnk"
}
If (Mouse_x > 99) and (Mouse_x < 147 ) ; over powershell ise
{
Run, explorer.exe
}
If (Mouse_x > 148) and (Mouse_x < 196 ) ; over chrome
{
Run, "%A_AppData%\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\outlook 2013.lnk"
}
If (Mouse_x > 197) and (Mouse_x < 245) ; over ie
{
Run, "%A_AppData%\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\Active Directory Users and Computers.lnk"
}
If (Mouse_x > 246) and (Mouse_x < 294 ) ; over vs 2015
{
Run, "%A_AppData%\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\DHCP.lnk"
}
If (Mouse_x > 295) and (Mouse_x < 343 ) ; over pusbullet
{
Run, "%A_AppData%\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\DNS.lnk"
}
}
}
IfEqual, Count, 3
{
If (Mouse_y > 1040)
{
If (Mouse_x > 50) and (Mouse_x < 98) ;over my explorer icon
{
Run, "%A_AppData%\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\Internet Explorer.lnk" -private
}
If (Mouse_x > 99) and (Mouse_x < 147 ) ; over powershell ise
{
Run, explorer.exe
}
If (Mouse_x > 148) and (Mouse_x < 196 ) ; over chrome
{
Run, "%A_AppData%\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\outlook 2013.lnk"
}
If (Mouse_x > 197) and (Mouse_x < 245) ; over ie
{
Run, "%A_AppData%\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\Active Directory Users and Computers.lnk"
}
If (Mouse_x > 246) and (Mouse_x < 294 ) ; over vs 2015
{
Run, "%A_AppData%\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\DHCP.lnk"
}
If (Mouse_x > 295) and (Mouse_x < 343 ) ; over pusbullet
{
Run, "%A_AppData%\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\DNS.lnk"
}
}
}