AutoHotKey 2 Script:
Code: Select all
#NoTrayIcon
DetectHiddenWindows True
SendBang(Bang)
{
cWnd := "RainmeterMeterWindow"
iLen := (StrLen(Bang) + 1) * 2
pCds := Buffer(3 * A_PtrSize, 0)
NumPut("UPtr", 1, pCds)
NumPut("UPtr", iLen, pCds, A_PtrSize)
NumPut("UPtr", StrPtr(Bang), pCds, 2 * A_PtrSize)
SendMessage(0x4a, 0, pCds.Ptr,, "ahk_class" . cWnd)
}
GetResult()
{
aAct := A_Args[1], aSep := A_Args[2], aInt := A_Args[3]
Loop
{
sOut := ""
wLis := WinGetList()
Loop wLis.Length
{
wHan := wLis[A_Index]
WTit := WinGetTitle("ahk_id " . wHan)
WCla := WinGetClass("ahk_id " . wHan)
WSty := WinGetStyle("ahk_id " . wHan)
wSta := !!WinExist("ahk_id " . wHan) . "`t" . !!(wSty & 0x10000000) . "`t" . !(wSty & 0x8000000) . "`t" . !!WinActive("ahk_id " . wHan) . "`t" . !!(wSty & 0x20000000) . "`t" . !!(wSty & 0x1000000)
WinGetPos(&wSeX, &wSeY, &wSeW, &wSeH, "ahk_id " . wHan)
pNum := WinGetPID("ahk_id " . wHan)
pNam := WinGetProcessName("ahk_id " . wHan)
sOut .= A_Index . "`t" . wTit . "`t" . wCla . "`t" . wHan . "`t" . wSta . "`t" . wSeX . "`t" . wSeY . "`t" . wSeW . "`t" . wSeH . "`t" . pNum . "`t" . pNam . "`t" . aSep
}
SendBang(StrReplace(aAct, "$Output", sOut))
Sleep aInt
}
Until (aInt < 0)
}
GetResult()
Problem:
After successfully compiling it using the provided AHK2EXE tool (seen in the middle of the below screenshot), when it comes to running the executable (from a Rainmeter skin seen at the bottom of the below screenshot), the following error is thrown (seen at the top of the below screenshot): For the record, the AutoHotKey 1 and AutoIt 3 versions of the script (in the spoiler below) work flawlessly.
Attempts:
- I tried to run Rainmeter as an administrator in order to elevate the compiled script, with no improvement
- I tried to compile the script to a 64 bit executable, with no improvement
- I tried reinstalling AutoHotKey 2.0.10 only for the current user, with no improvement (earlier, it was installed for all users)
- I tried installing the 2.0.14 version of AutoHotKey, with no improvement
Info:
In case it matters, the scripts above build a list of all existing windows with their properties. The windows are newline separated and their properties are tab separated. A Rainmeter skin is simply running the compiled script executable with the "[!SetVariable Windows ""$Output"" ""#CURRENTCONFIG#""]" "#CRLF#" "1000" parameters, so that the executable sends the 1st parameter "bang" back to the skin, every 1000 ms. That "bang" assigns the window list string to a variable in the skin.
Other:
Can't speak for the AHK 2 script result because of the error, but I see that these windows don't have a process name in the error free result of the AHK 1 script:
Code: Select all
369 NvSvc NVSVC64.DLL 0x2008c 1 0 0 0 0 0 208 208 1440 767 3876
370 UxdService UxdService 0x10232 1 0 0 0 0 0 182 182 1440 767 3876
375 SmartDC SmartDC 0x10086 1 0 1 0 0 0 0 0 136 39 3984
376 NvContainerWindowClass00000F24 NvContainerWindowClass00000F24 0x10082 1 0 1 0 0 0 0 0 0 0 3876
377 AMD EEU Client AMD EEU Client 0x1006e 1 0 1 0 0 0 0 0 0 0 3984
378 DWM Notification Window Dwm 0x10052 1 0 1 0 1 0 -32000 -32000 160 28 1568
465 Default IME IME 0x10088 1 0 0 0 0 0 0 0 0 0 3984
466 Default IME IME 0x10070 1 0 0 0 0 0 0 0 0 0 3984