Published on

마우스 커서 좌표 구하기

Authors
  • avatar
    Name
    Mason Na
    Twitter

마우스 커서 좌표 구하기(powershell, Chrome)

powershell

code 💡

Add-Type -AssemblyName System.Windows.Forms

while ($true) {
    $mousePosition = [System.Windows.Forms.Cursor]::Position

    $xCoord = $mousePosition.X
    $yCoord = $mousePosition.Y

    Clear-Host
    Write-Host "mouse cursor position x: $xCoord"
    Write-Host "mouse cursor position y: $yCoord"

    Start-Sleep -Milliseconds 100
}

Chrome(개발자 모드)

code 💡

var x, y; document.onmousemove=(e)=>{x=e.pageX;y=e.pageY;}

console.log(x, y);