Created
January 18, 2026 06:28
-
-
Save qoli/2f865fadfd570b6a990d1a99b2d80fd6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env zsh | |
| # 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 | |
| # 檢查輸入參數 | |
| if [ -z "$1" ]; then | |
| echo "No input provided." | |
| exit 1 | |
| fi | |
| app_name="Simulator" | |
| # 激活模擬器應用 | |
| osascript -e "activate application \"$app_name\"" | |
| # 延遲1秒,確保模擬器獲得焦點 | |
| sleep 1 | |
| # 對每個字符增加延遲輸入 | |
| input="$1" | |
| length=${#input}+1 | |
| for (( i=0; i<length; i++ )); do | |
| char="${input[i]}" | |
| osascript -e "tell application \"System Events\" to keystroke \"$char\"" | |
| sleep 0.05 # 增加延遲,調整此值以改善輸入穩定性 | |
| done | |
| # 打印輸入內容 | |
| echo "input: $1" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment