Appearance
Introduction
What is CatScript?
CatScript is an automation framework for iOS. It uses Python 3.10 and provides modules for building custom automation scripts.
Basic Logic
The core modules for script development are screen and touch. The screen module lets you inspect screen pixels, and touch simulates taps and gestures. A script usually checks the current screen state and then performs an action based on the result.
The ui module complements screen-based automation. It reads the accessibility element tree of the frontmost app, so scripts can locate controls by label or role and tap their center coordinates.
Script Directory
The default script directory is /var/mobile/Media/CatScript.
Example
Here is a simple CatScript script:
python
from catscript import screen, touch
if __name__ == "__main__":
if screen.is_color([(100, 100, 0x00FF00), (200, 200, 0x0000FF)]):
touch.click(500, 500)If the pixel at (100, 100) is #00FF00 and the pixel at (200, 200) is #0000FF, CatScript taps (500, 500).