Emojis for all

Post your working scripts, libraries and tools for AHK v1.1 and older
D7ego

Emojis for all

25 May 2017, 05:18

Hi everybody,

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:
and it will insert the :) emoji.

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 :D


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
And an extract of my personalized hotstrings in emojiOnePersonal.ahk :

Code: Select all

:::like::
  emojiOne("1f44d-1f3fb")   ; thumbsup_tone1 
return

:::dislike::
  emojiOne("1f44e-1f3fb")   ; :thumbsdown_tone1 
return

:::oops::
  emojiOne("1f64a")   ; speak_no_evil 
return
Ps: sorry for English mistakes

Return to “Scripts and Functions (v1)”

Who is online

Users browsing this forum: Chunjee and 143 guests