Skip to content

Instantly share code, notes, and snippets.

@wirtzdan
Created March 21, 2025 14:26
Show Gist options
  • Save wirtzdan/44145652ec7782c1e1e064503a4a12ad to your computer and use it in GitHub Desktop.
Save wirtzdan/44145652ec7782c1e1e064503a4a12ad to your computer and use it in GitHub Desktop.
Open Selected Text in Root Search (Raycast Script)
#!/usr/bin/osascript
# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title Open Selected Text In Root Search
# @raycast.mode silent
# Optional parameters:
# @raycast.icon 🔍
# @raycast.packageName open-selected-text
# Documentation:
# @raycast.description Opens selected text in Raycast root search
# @raycast.author wirtzdan
# @raycast.authorURL https://raycast.com/wirtzdan
on run
-- Get the selected text
set selectedText to ""
tell application "System Events"
keystroke "c" using {command down}
delay 0.1
end tell
set selectedText to (the clipboard)
-- Open Raycast and paste the text
tell application "System Events"
-- Trigger Raycast (assuming default Command + Space shortcut)
keystroke " " using {command down}
delay 0.1
-- Paste the selected text
keystroke "v" using {command down}
end tell
end run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment