GetUIObjectAtPosition(integer, table)

grandMA3 ユーザマニュアル » プラグイン » Lua 関数 - Object-Free API » GetUIObjectAtPosition(integer, table)
Version 2.2

説明

GetUIObjectAtPosition 関数は、指定されたディスプレイ上の指定位置にあるUIオブジェクトのハンドルを返します。

引数

  • integer:
    UIオブジェクトを含むディスプレイのインデックス番号です。
  • table:
    テーブルには、以下のキーを持つ2つの要素が必要です。
    • x: ディスプレイ上のX位置です。値は、目的のピクセル位置を示す数値で、ディスプレイの左側からカウントされます。
    • y: ディスプレイ上のY位置です。値は、目的のピクセル位置を示す数値で、ディスプレイの上側からカウントされます。

戻り値

  • handle または nil:
    UIオブジェクトが指定された位置にある場合は、そのオブジェクトへのハンドルが返されます。それ以外の場合は nil を返します。

ディスプレイ1の特定位置にUIオブジェクトに関する情報を Dump() 関数で出力します。また、DrawPointer() 関数を用いて、その位置に赤いポインタを描画します。

Lua
return function()
    -- Get the index number for "Display 1"
    local displayIndex = GetDisplayCollect()["Display 1"].INDEX
    -- Create a table with X and Y position
    local positionTable = {}
    positionTable.x = 1000
    positionTable.y = 500
    -- Get the UI object handle
    local uiObjectAtPositionHandle = GetUIObjectAtPosition(displayIndex,positionTable)
    -- Dump all information about the display with the index number if not nil
    if uiObjectAtPositionHandle == nil then
        Printf("The returned value was not a valid handle.")
        return
    end
    -- Draw a pointer at the posiiton for 5 seconds
    DrawPointer(displayIndex,positionTable,5000)
    --Dump of the UIObject
    Printf("=============== START OF DUMP ===============")
    uiObjectAtPositionHandle:Dump()
    Printf("================ END OF DUMP ================")
end