mac-app-play
Control macOS GUI applications via screen capture, mouse/keyboard automation, and accessibility element inspection. Use when you need to interact with macOS app UIs, take screenshots, click buttons, type text, or inspect accessibility trees. --- # mac-app-play The `scripts/mac_app_play` CLI provides mouse control, keyboard input, screenshot capture, and accessibility tree inspection for macOS applications. ## Prerequisites ```bash scripts/mac_app_play permission check --all scripts/mac_app_play permission request --accessibility scripts/mac_app_play permission request --screen-recording ``` - **Accessibility**: required for mouse, keyboard, focus, and ax commands. - **Screen Recording**: required for screenshot command. ## Coordinates and resolution All coordinates use **screen points** — logical coordinates with origin at the **top-left of the primary display**. On Retina displays, 1 point = 2 pixels. | Context | Coordinate space | |---|---| | **mouse** commands | Screen points | | **ax** positions | Screen points | | **screenshot** (default 1x) | Image pixels = screen points (full screen/display capture) | | **screenshot** (`--high-resolution`) | Image pixels = screen points × scale factor | | **screenshot** (`--app` / `--window-id`) | Window-local: (0,0) is the window's top-left corner | **Converting window screenshot coordinates to screen points**: When capturing a window, the command prints the window's screen position (e.g., `at (100,200 800x600)`). Add the window origin to image coordinates to get screen points for mouse commands: screen_x = window_x + image_x, screen_y = window_y + image_y. Use `display-info` to check the scale factor when working with `--high-resolution`. ## Commands ### screenshot — Capture screen or window to PNG ```bash scripts/mac_app_play screenshot --output /tmp/screen.png scripts/mac_app_play screenshot --app Safari --output /tmp/safari.png scripts/mac_app_play screenshot --window-id 1234 --output /tmp/win.png scripts/mac_app_play sc
更新日志: Source: GitHub https://github.com/niw/MacAppPlay
还没有评论,快来第一个发言吧。