Skip to content

app ​

Many functions in this module require the bundle identifier of the app. You can obtain the bundle identifier of installed apps under "CatScript -> Settings -> Apps."

app.list() ​

Get the list of installed third-party apps.

python
app.list() -> list[dict[str, str]]

Arguments ​

None.

Return ​

A list of dictionaries. Each dictionary contains only:

KeyTypeDescription
idstrThe bundle identifier.
namestrThe display name.

Example ​

python
from catscript import app, sys

if __name__ == "__main__":
    for item in app.list():
        sys.log(f"{item['name']}: {item['id']}")

app.bundle_path() ​

Get the bundle path of an app.

python
app.bundle_path(id: str) -> str

Arguments ​

NameTypeDefaultDescription
idstrThe bundle identifier of the app.

Return ​

TypeDescription
strThe bundle path of the app.

Example ​

python
from catscript import app, sys

if __name__ == "__main__":
    sys.log(app.bundle_path(app.front()))

app.data_path() ​

Get the data path of an app.

python
app.data_path(id: str) -> str

Arguments ​

NameTypeDefaultDescription
idstrThe bundle identifier of the app.

Return ​

TypeDescription
strThe data path of the app.

Example ​

python
from catscript import app, sys

if __name__ == "__main__":
    sys.log(app.data_path(app.front()))

app.front() ​

Get the bundle identifier of the front app.

python
app.front() -> str

Arguments ​

None.

Return ​

TypeDescription
strThe bundle identifier of the front app.

Example ​

python
from catscript import app, sys

if __name__ == "__main__":
    sys.log(app.front())

app.run() ​

Launch a specified app.

python
app.run(id: str) -> None

Arguments ​

NameTypeDefaultDescription
idstrThe bundle identifier of the app.

Return ​

None.

Example ​

python
from catscript import app

if __name__ == "__main__":
    app.run("com.apple.mobilesafari")

app.kill() ​

Kill a specified app.

python
app.kill(id: str) -> None

Arguments ​

NameTypeDefaultDescription
idstrThe bundle identifier of the app.

Return ​

None.

Example ​

python
from catscript import app

if __name__ == "__main__":
    app.kill("com.apple.mobilesafari")

app.uninstall() ​

Uninstall an app.

WARNING

This is a destructive operation. There is no confirmation prompt.

python
app.uninstall(id: str) -> None

Arguments ​

NameTypeDefaultDescription
idstrThe bundle identifier of the app.

Return ​

None.

Raises RuntimeError if the app does not exist or the uninstall fails.

Example ​

python
from catscript import app

if __name__ == "__main__":
    app.uninstall("com.example.app")