Created
March 17, 2016 19:58
-
-
Save shokai/efe5556bd9e00faf14dc 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/osascript -l JavaScript | |
| function input(emoji){ | |
| var app = Application("System Events"); | |
| app.includeStandardAdditions = true; | |
| var currentClipboard = app.theClipboard(); | |
| app.setTheClipboardTo(emoji); | |
| app.keystroke("v", {using: "command down"}); | |
| delay(1); | |
| app.setTheClipboardTo(currentClipboard); | |
| } | |
| function getRandomEmoji(){ | |
| const emojis = [ | |
| "😀", | |
| "😁", | |
| "😂", | |
| "👿", | |
| "👺" | |
| ]; | |
| return emojis[Math.floor(Math.random()*emojis.length)]; | |
| } | |
| input(getRandomEmoji()); |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
AppleScript (JXA)で絵文字を入力する
delay(1)が無いとペーストする前に戻してしまう