Created
August 30, 2025 22:19
-
-
Save loxal/730cd2fb8d5702a25ca3fbb48ad3d165 to your computer and use it in GitHub Desktop.
Run an AI query in the Comet/Chrome browser from the CLI
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
| # Run from the Nushell terminal: `?? Who are you?` | |
| def --wrapped "??" [...user_prompt_phrase: string] { | |
| let user_prompt = ($user_prompt_phrase | str join " ") | |
| osascript ~/my/cfg/cli_ai_query.applescript $user_prompt | |
| } |
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
| on run argv | |
| set userText to "Show me the time!" | |
| try | |
| if (count of argv) > 0 then set userText to (item 1 of argv) as text | |
| end try | |
| tell application "Comet" to activate | |
| tell application "System Events" | |
| keystroke "t" using {command down} -- New Tab | |
| keystroke "l" using {command down} -- focus address bar | |
| -- keystroke "Who are you?" | |
| keystroke userText | |
| keystroke return using {shift down} -- Shift+Return | |
| end tell | |
| end run |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment