restore examples

This commit is contained in:
Dillon DuPont
2025-05-26 23:30:32 -04:00
parent bf869c630c
commit c90ca1ca68

View File

@@ -62,8 +62,8 @@ async def main():
# res = await computer.interface.run_command("touch ./Downloads/empty_file")
# print(f"Run command result: {res}")
# accessibility_tree = await computer.interface.get_accessibility_tree()
# print(f"Accessibility tree: {accessibility_tree}")
accessibility_tree = await computer.interface.get_accessibility_tree()
print(f"Accessibility tree: {accessibility_tree}")
# Screen Actions Examples
# print("\n=== Screen Actions ===")
@@ -71,36 +71,36 @@ async def main():
# with open("screenshot_direct.png", "wb") as f:
# f.write(screenshot)
# screen_size = await computer.interface.get_screen_size()
# print(f"Screen size: {screen_size}")
screen_size = await computer.interface.get_screen_size()
print(f"Screen size: {screen_size}")
# Demonstrate coordinate conversion
# center_x, center_y = 733, 736
# print(f"Center in screen coordinates: ({center_x}, {center_y})")
center_x, center_y = 733, 736
print(f"Center in screen coordinates: ({center_x}, {center_y})")
# screenshot_center = await computer.to_screenshot_coordinates(center_x, center_y)
# print(f"Center in screenshot coordinates: {screenshot_center}")
screenshot_center = await computer.to_screenshot_coordinates(center_x, center_y)
print(f"Center in screenshot coordinates: {screenshot_center}")
# screen_center = await computer.to_screen_coordinates(*screenshot_center)
# print(f"Back to screen coordinates: {screen_center}")
screen_center = await computer.to_screen_coordinates(*screenshot_center)
print(f"Back to screen coordinates: {screen_center}")
# Mouse Actions Examples
# print("\n=== Mouse Actions ===")
# await computer.interface.move_cursor(100, 100)
# await computer.interface.left_click()
# await computer.interface.right_click(300, 300)
# await computer.interface.double_click(400, 400)
print("\n=== Mouse Actions ===")
await computer.interface.move_cursor(100, 100)
await computer.interface.left_click()
await computer.interface.right_click(300, 300)
await computer.interface.double_click(400, 400)
# # Keyboard Actions Examples
# print("\n=== Keyboard Actions ===")
# await computer.interface.type_text("Hello, World!")
# await computer.interface.press_key("enter")
# Keyboard Actions Examples
print("\n=== Keyboard Actions ===")
await computer.interface.type_text("Hello, World!")
await computer.interface.press_key("enter")
# # Clipboard Actions Examples
# print("\n=== Clipboard Actions ===")
# await computer.interface.set_clipboard("Test clipboard")
# content = await computer.interface.copy_to_clipboard()
# print(f"Clipboard content: {content}")
# Clipboard Actions Examples
print("\n=== Clipboard Actions ===")
await computer.interface.set_clipboard("Test clipboard")
content = await computer.interface.copy_to_clipboard()
print(f"Clipboard content: {content}")
finally:
# Important to clean up resources