I'm a lover and heavy user of emojis on WhatsApp web application but I was disappointed with the lack of shortcuts for emojis… so I decided to create my own!
I used the entire code list provided by EmojiOne wich syntaxe is pretty simple. You just have to type
Code: Select all
:smile:
The entire project repository : https://gitlab.com/smart-autohotkey/emojione
You will see that you can restrict the script to work only in some windows (WhatsApp, Skype etc…) and also customize it with your own shortcuts.
As this is my first public project, please don't hesitate to comment and give me some advice to improve! I would be really thankful
Here you have the code of the main ahk script :
Code: Select all
; If EndChar is a colon, insert the unicode emoji.
; Otherwise insert the Hotstring followed by EndChar.
emojiOne(unicode){
If (A_EndChar = ":") {
SendInput {U+%unicode%}
} Else {
StringMid, s, A_ThisHotKey, 3 ; A_ThisHotKey contains 2 starting colons
SendRaw %s%%A_EndChar%
}
/*
; === IfEqual syntaxe ===
IfEqual, A_EndChar, ":":, SendInput {U+%unicode%}
Else {
StringMid, s, A_ThisHotKey, 3
SendRaw %s%%A_EndChar%
}
*/
}
SetTitleMatchMode 2 ; Window title of GroupAdd should only contain WinTitle
; Add below a line for each application you want the Hotstrings be activated
GroupAdd, emojiGroup, WhatsChrome
GroupAdd, emojiGroup, Skype
GroupAdd, emojiGroup, Hangouts ; not tested
GroupAdd, emojiGroup, Messenger ; not tested
GroupAdd, emojiGroup, Slack ; not tested
; GroupAdd, emojiGroup, NameOfWindowApplication
; Add "ahk_group emojiGroup" if you want to apply Hotstring to some windows.
; Remove "ahk_group emojiGroup" if you want to apply Hotstrings to all windows.
#IfWinActive
; Use of ? to trigger even if it's inside another word
; No use of * because we need to evaluate the EndChar
; No use of o because we need to print it if it's not a colon
#Hotstring ?
; Include of all Hotstrings if files exists (*i → error-friendly)
; Hotstrings from the source alpha codes
#Include *i emojiOneAlphaCodes.ahk
; Hotstrings from the source alias list
#Include *i emojiOneAliases.ahk
; My personalized Hotstrings with EmojiOne syntaxe
#Include *i emojiOnePersonal.ahk
#Hotstring ?0
#IfWinActive
Code: Select all
:::like::
emojiOne("1f44d-1f3fb") ; thumbsup_tone1
return
:::dislike::
emojiOne("1f44e-1f3fb") ; :thumbsdown_tone1
return
:::oops::
emojiOne("1f64a") ; speak_no_evil
return