CoordMode() as it exists requires two parameters.

Issue #43 closed
Winter Laite created an issue

In AHK, CoordMode() can be called with a single parameter, i.e.

CoordMode("Pixel")

This will cause the optional second parameter to default to “Screen”.

In Keysharp at present, it appears the second parameter is formal and required.

Both of these calls will work:

CoordMode("Pixel", "Screen")
CoordMode("Pixel", )

Trivial. Suggest allowing ‘CoordMode(<first param>)’ to default to “Screen” if second param (obj1 in code) is omitted for compatibility with existing AHK syntax.

Comments (4)

  1. Winter Laite reporter

    Tested with code below, works!

    CoordMode("Pixel")  ; Interprets the coordinates below as relative to the screen rather than the active window.
    
    result := ImageSearch(0, 0, A_ScreenWidth, A_ScreenHeight, "killbill.png")
    
    If (result["X"] != "")
        MsgBox("Found at x: " result["X"] " y: " result["Y"])
    Else
        MsgBox("Image not found!")
    

    Found the image at the proper coordinates.

    Please mark resolved and close. Thanks!

  2. Log in to comment