|
|
|
title: Computer API |
|
|
|
|
|
The following functions are designed for language models to use in Open Interpreter, currently only supported in [OS Mode](/guides/os-mode/). |
|
|
|
|
|
|
|
Takes a screenshot of the primary display. |
|
|
|
|
|
|
|
```python |
|
interpreter.computer.display.view() |
|
``` |
|
|
|
|
|
|
|
|
|
|
|
Gets the x, y value of the center of the screen. |
|
|
|
|
|
|
|
```python |
|
x, y = interpreter.computer.display.center() |
|
``` |
|
|
|
|
|
|
|
|
|
|
|
Performs a hotkey on the computer |
|
|
|
|
|
|
|
```python |
|
interpreter.computer.keboard.hotkey(" ", "command") |
|
``` |
|
|
|
|
|
|
|
|
|
|
|
Writes the text into the currently focused window. |
|
|
|
|
|
|
|
```python |
|
interpreter.computer.keyboard.write("hello") |
|
``` |
|
|
|
|
|
|
|
|
|
|
|
Clicks on the specified coordinates, or an icon, or text. If text is specified, OCR will be run on the screenshot to find the text coordinates and click on it. |
|
|
|
|
|
|
|
```python |
|
|
|
interpreter.computer.mouse.click(x=100, y=100) |
|
|
|
|
|
interpreter.computer.mouse.click("Onscreen Text") |
|
|
|
|
|
interpreter.computer.mouse.click(icon="gear icon") |
|
``` |
|
|
|
|
|
|
|
|
|
|
|
Moves to the specified coordinates, or an icon, or text. If text is specified, OCR will be run on the screenshot to find the text coordinates and move to it. |
|
|
|
|
|
|
|
```python |
|
|
|
interpreter.computer.mouse.move(x=100, y=100) |
|
|
|
|
|
interpreter.computer.mouse.move("Onscreen Text") |
|
|
|
|
|
interpreter.computer.mouse.move(icon="gear icon") |
|
``` |
|
|
|
|
|
|
|
|
|
|
|
Scrolls the mouse a specified number of pixels. |
|
|
|
|
|
|
|
```python |
|
|
|
interpreter.computer.mouse.scroll(-10) |
|
|
|
|
|
interpreter.computer.mouse.scroll(10) |
|
``` |
|
|
|
|
|
|
|
|
|
|
|
Returns the contents of the clipboard. |
|
|
|
|
|
|
|
```python |
|
interpreter.computer.clipboard.view() |
|
``` |
|
|
|
|
|
|
|
|
|
|
|
Get the selected text on the screen. |
|
|
|
|
|
|
|
```python |
|
interpreter.computer.os.get_selected_text() |
|
``` |
|
|
|
|
|
|
|
|
|
|
|
Retrieves the last `number` emails from the inbox, optionally filtering for only unread emails. (Mac only) |
|
|
|
|
|
|
|
```python |
|
interpreter.computer.mail.get(number=10, unread=True) |
|
``` |
|
|
|
|
|
|
|
|
|
|
|
Sends an email with the given parameters using the default mail app. (Mac only) |
|
|
|
|
|
|
|
```python |
|
interpreter.computer.mail.send("[email protected]", "Subject", "Body", ["path/to/attachment.pdf", "path/to/attachment2.pdf"]) |
|
``` |
|
|
|
|
|
|
|
|
|
|
|
Retrieves the count of unread emails in the inbox. (Mac only) |
|
|
|
|
|
|
|
```python |
|
interpreter.computer.mail.unread_count() |
|
``` |
|
|
|
|
|
|
|
|
|
|
|
Send a text message using the default SMS app. (Mac only) |
|
|
|
|
|
|
|
```python |
|
interpreter.computer.sms.send("2068675309", "Hello from Open Interpreter!") |
|
``` |
|
|
|
|
|
|
|
|
|
|
|
Returns the phone number of a contact name. (Mac only) |
|
|
|
|
|
|
|
```python |
|
interpreter.computer.contacts.get_phone_number("John Doe") |
|
``` |
|
|
|
|
|
|
|
|
|
|
|
Returns the email of a contact name. (Mac only) |
|
|
|
|
|
|
|
```python |
|
interpreter.computer.contacts.get_phone_number("John Doe") |
|
``` |
|
|
|
|
|
|
|
|
|
|
|
Fetches calendar events for the given date or date range from all calendars. (Mac only) |
|
|
|
|
|
|
|
```python |
|
interpreter.computer.calendar.get_events(start_date=datetime, end_date=datetime) |
|
``` |
|
|
|
|
|
|
|
|
|
|
|
Creates a new calendar event. Uses first calendar if none is specified (Mac only) |
|
|
|
|
|
|
|
```python |
|
interpreter.computer.calendar.create_event(title="Title", start_date=datetime, end_date=datetime, location="Location", notes="Notes", calendar="Work") |
|
``` |
|
|
|
|
|
|
|
|
|
|
|
Delete a specific calendar event. (Mac only) |
|
|
|
|
|
|
|
```python |
|
interpreter.computer.calendar.delete_event(event_title="Title", start_date=datetime, calendar="Work") |
|
``` |
|
|
|
|
|
|
|
|