Repository navigation
Screen Functions
Oğuzhan edited this page Jul 21, 2025
·
2 revisions
To easily use the screen:
const {screen} = jsautogui // jsautogui has to be defined
// or
import {screen} from "jsautogui" // modulejs
// or
const {screen} = require("jsautogui") // commonjsGets the size of the screen as an object.
const size = screen.size
console.log(size.width) // 1536
console.log(size.height) // 864Gets the width/height of the screen.
console.log(screen.width) // 1536
console.log(screen.height) // 864Gets the center position of the screen as an object.
console.log(screen.center.x) // 768
console.log(screen.center.y) // 432Checks whether the given position is in the screen bounds.
console.log(screen.contains(-100, -50)); // false
console.log(screen.contains(1536, 864)); // false
console.log(screen.contains(1535, 863)); // true
console.log(screen.contains(100, 200)); // true