WinGetPos relies on missing assembly - System.Drawing.Primitives.
Issue #25
closed
Test code (differs quite a bit from AHK):
if (WinExist("Untitled - Notepad"))
{
sop := WinGetPos() ; Use the window found by WinExist.
MsgBox("Notepad is at " sop["X"] "," sop["Y"])
}
The error thrown is:
The following errors occurred:ws_ks.ahk:: (142,9)-(142,18) - The type 'Rectangle' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Drawing.Primitives, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
Comments (5)
-
reporter -
reporter Could also be “X”, “Y”, “W”, “H” as in the AHK docs, I guess. But there are more properties at MSDN for Rectangle.
-
reporter Tested fix of August 18, 2022 with this code:
if (WinExist("Untitled - Notepad")) { sop := WinGetPos() ; Use the window found by WinExist. MsgBox("Notepad is at X: " sop["X"] ", Y: " sop["Y"] "`n Width: " sop["Width"] ", Height " sop["Height"]) }
Works. Please mark resolved and close. Thanks!
-
repo owner - changed status to resolved
-
repo owner - changed status to closed
- Log in to comment
I just guessed at the parameters object, I thought “X”, “Y”, “Width”, “Height” would probably be correct for the object, but even if it is just “X” and “Y” I figured it would work.
(I also tried adding a reference to System.Drawing.Primitives in VS 2022, but all I did was destroy the project.)