This link suggests a method that may have worked on Windows 10, but that apparently no longer works.
Where is the list of pinned start menu and taskbar items stored in Windows 7 - Super User
https://superuser.com/questions/171096/ ... -windows-7
I have a slightly hacky workaround that uses Acc to pin WordPad to the taskbar, that works in Windows 7, it right-clicks the taskbar button and chooses 'Pin this program to taskbar' if available. So it's possible that that might work in Windows 10. It may be that the script needs to be modified slightly if the system language isn't English.
Code: Select all
;[Acc functions]
;Acc library (MSAA) and AccViewer download links - AutoHotkey Community
;https://autohotkey.com/boards/viewtopic.php?f=6&t=26201
q:: ;explorer - pin WordPad to the taskbar (tested on Windows 7)
DetectHiddenWindows, Off
Run, wordpad.exe,,, vPID
WinWaitActive, % "ahk_pid " vPID
WinGet, vWinList, List, % "ahk_pid " vPID
oArray := {}
Loop, % vWinList
{
hWnd := vWinList%A_Index%
WinGetTitle, vWinTitle, % "ahk_id " hWnd
if !(vWinTitle = "")
oArray["z" vWinTitle] := ""
}
ControlGet, hWnd, Hwnd,, MSTaskListWClass1, ahk_class Shell_TrayWnd
oAcc := Acc_Get("Object", "4", 0, "ahk_id " hWnd)
Loop, % oAcc.accChildCount
{
vName := ""
try vName := oAcc.accName(A_Index)
if oArray.HasKey("z" vName)
{
oRect := Acc_Location(oAcc, A_Index)
CoordMode, Mouse, Screen
Click, % Format("R, {:i}, {:i}", oRect.x + oRect.w/2, oRect.y + oRect.h/2)
;ToolTip, % Format("R, {:i}, {:i}", oRect.x + oRect.w/2, oRect.y + oRect.h/2)
WinWaitActive, Jump List ahk_class DV2ControlHost
ControlGet, hWnd, Hwnd,, SysListView321, Jump List ahk_class DV2ControlHost
oAcc2 := Acc_Get("Object", "4", 0, "ahk_id " hWnd)
Loop, % oAcc2.accChildCount
{
vName := ""
try vName .= oAcc2.accName(A_Index)
;ToolTip, % A_Index " " vName
;Sleep, 1000
if (vName = "Pin this program to taskbar")
{
oAcc2.accDoDefaultAction(A_Index)
break
}
}
if (vName = "Pin this program to taskbar")
break
}
}
oAcc := oRect := oArray := ""
return
Some related code:
Move mouse to taskbar to use AeroPeek - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=5&t=27147
Explorer window interaction (folder windows/Desktop, file/folder enumeration/selection/navigation/creation) - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=6&t=35041