Page 1 of 1

Move mouse to taskbar to use AeroPeek

Posted: 20 Jan 2017, 22:27
by magpac
I have a script to automate starting a number of apps, and one part I'd like to do but have no idea how to achieve it.

What I want is to start multiple copies of an app (they are VM's and I've got that bit), wait for them to finish loading (I've figured out Winwait, so tha's ok) and then move the mouse to the taskbar, over the icon for the first VM, so I can use Aeropeek to watch all the VMs in parallel to wait for them all to finish an action, before I initiate the next one.

So: Is there any way to launch an app, and then find the screen coordinates of the taskbar button associated with app?

Ideally I want to Start VM1, find the location of the taskbar button for that app and save it, do a bunch more mousemoves/mouseclicks to launch more Vms, then move the mouse back over the button and let Aeropeek do it's thing so I can tell when they are all waiting for further input.

Re: Move mouse to taskbar to use AeroPeek

Posted: 21 Jan 2017, 03:09
by Guest
I found this: http://blog.strixcode.com/2011/01/how-t ... on-on.html which gives a method of doing it, but I don't know how to translate that to Autohotkey.

Though a comment there suggests "Better is to use the Microsoft MSAA API. Use AccChecker_v2.0_x86 ->AccCheckUI.exe to display this object tree. This object tree contains the taskbar buttons, their position and their title."

Re: Move mouse to taskbar to use AeroPeek  Topic is solved

Posted: 21 Jan 2017, 05:24
by jeeswg
Hopefully this should do it to get the taskbar button coordinates.

Code: Select all

q:: ;taskbar get item names + coords (tested on Windows 7)
DetectHiddenWindows, On
ControlGet, hWnd, Hwnd, , MSTaskListWClass1, ahk_class Shell_TrayWnd
oAcc := Acc_Get("Object", "tool bar", 0, "ahk_id " hWnd)

vOutput := ""
Loop, % oAcc.accChildCount
oRect := Acc_Location(oAcc, A_Index), vOutput .= oRect.x " " oRect.y " " oRect.w " " oRect.h "`t" oAcc.accName(A_Index) "`r`n"
Clipboard := vOutput
MsgBox % "done"
Return
[this code was based on:]
Windows Update: detect if important updates available - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=5&t=26727
- JEE_ExpGetSystrayItems
- JEE_ExpUpdatesAvailable
- JEE_ExpGetTaskbarItems

[AccViewer is a very good window spy, and in order to run the Acc functions above:]
Acc library (MSAA) and AccViewer download links - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=6&t=26201

Re: Move mouse to taskbar to use AeroPeek

Posted: 21 Jan 2017, 16:03
by magpac
Thank you.

That seems to work fine, and will be almost directly usable for what I want.

Re: Move mouse to taskbar to use AeroPeek

Posted: 20 Jan 2020, 14:37
by kh_model
I am new to AHK programming. My test of the script posted above was conducted with the Windows 7 Professional 64 bit operating system and AHK version 1.0.48.05. When I run the script I get the following error:

-------------------------------------------
Error at Line 7.

The following variable name contains an illegal character:
"oAcc.accChildCount".

The program will exit.
-------------------------------------------

Is there any workaround which would allow me to fix the error without updating to a newer version of AHK? Can anyone explain what might be the cause of this particular error?

Thank you in advance for your time and consideration.

Re: Move mouse to taskbar to use AeroPeek

Posted: 20 Jan 2020, 15:34
by kh_model

Re: Move mouse to taskbar to use AeroPeek

Posted: 20 Jan 2020, 16:07
by gregster
kh_model wrote:
20 Jan 2020, 14:37
AHK version 1.0.48.05.
This is much too old for the Acc library.