Last active
December 23, 2020 09:51
-
-
Save homam/0119797f5870d046a362 to your computer and use it in GitHub Desktop.
AppleScripts for sending iMessages and Attachment
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
osascript send-imessage.scpt "hello" "Homam Hosseini" | |
osascript send-imessage-pic.scpt `realpath northamerica-neb.jpg` "Homam Hosseini" |
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
realpath() { | |
[[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}" | |
} |
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
on run argv | |
set filename to item 1 of argv | |
set buddyName to item 2 of argv | |
set attach to POSIX file filename | |
tell application "Messages" to send attach to buddy buddyName | |
end run |
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
on run argv | |
set message to item 1 of argv | |
set chatNumber to item 2 of argv as integer | |
tell application "Messages" to send message to item chatNumber of text chats | |
end run |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I can't send image. Please check