Skip to content

Instantly share code, notes, and snippets.

@qoli
Created October 11, 2023 09:58
Show Gist options
  • Save qoli/0e3050125a6950a5cf514931c8ac9c11 to your computer and use it in GitHub Desktop.
Save qoli/0e3050125a6950a5cf514931c8ac9c11 to your computer and use it in GitHub Desktop.
允許粘貼板或其他方式快捷輸入 tvOS 模擬器
#!/usr/bin/env python3
# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title Simulator Input
# @raycast.mode silent
# Optional parameters:
# @raycast.icon ⌨️
# @raycast.argument1 { "type": "text", "placeholder": "Placeholder" }
# Documentation:
# @raycast.author qoli
# @raycast.authorURL https://raycast.com/qoli
import sys
import time
import pyautogui
import subprocess
app_name = "Simulator"
cmd = f'osascript -e \'activate application "{app_name}"\''
subprocess.call(cmd, shell=True)
# 延迟1秒,确保模拟器获得焦点
time.sleep(1)
# 模拟键盘输入
pyautogui.typewrite(sys.argv[1])
print("input: " + sys.argv[1])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment