Last active
February 26, 2023 15:58
-
-
Save henrik/8b002ae46ca96217c32b0824bdc8dda8 to your computer and use it in GitHub Desktop.
Raycast script command to send a Messages.app IM to a fixed contact, or just switch to Messages if no argument is provided. Don't forget to customize `theEmail`.
This file contains 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 osascript | |
# Required parameters: | |
# @raycast.schemaVersion 1 | |
# @raycast.title Send IM | |
# @raycast.mode silent | |
# Optional parameters: | |
# @raycast.icon 💬 | |
# @raycast.author Henrik Nyh | |
# @raycast.argument1 { "type": "text", "placeholder": "message", "optional": true } | |
on run argv | |
-- Customize this. | |
set theEmail to "[email protected]" | |
set theMessage to (item 1 of argv) | |
if length of theMessage is greater than 0 then | |
tell application "Messages" to send theMessage to buddy theEmail of (service 1 whose service type is iMessage) | |
-- Toast output. | |
"Sent: " & theMessage | |
else | |
tell application "Messages" to activate | |
-- Toast output. | |
"Switching to Messages" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment