Skip to content
This repository has been archived by the owner on Apr 5, 2022. It is now read-only.

Commit

Permalink
🚀 Emoji panel shortcut added (❖ Win ✲ Ctrl Ş "emoji panel with ctrl")
Browse files Browse the repository at this point in the history
  • Loading branch information
yemreak committed Jul 18, 2020
1 parent d8d453c commit 11f2d61
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 12 deletions.
5 changes: 4 additions & 1 deletion docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ description: YHotkeys'de neler değişti

* [🏷️ Release](https://github.com/yedhrab/YHotkeys/releases) alanından tüm değişikliklere bakabilirsiniz.

## 🏷️ 2.4.3.2

* 🚀 Emoji panel shortcut added (❖ Win ✲ Ctrl Ş "emoji panel with ctrl")

## 🏷️ 2.4.3.1

✨ More useful shortcuts and translator
Expand Down Expand Up @@ -196,4 +200,3 @@ description: YHotkeys'de neler değişti
* 💖 Emojiler artırıldı
* 👨‍💻 Kodlamada iyileştirme yapıldı
* 📂 Dosyalar yeniden yapılandırıldı

14 changes: 4 additions & 10 deletions src/YHotkeys.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,13 @@
; v1.1.31.01'de tüm desktoplarda çalışır
; https://www.autohotkey.com/download/1.1/AutoHotkey_1.1.31.01_setup.exe

#Warn ; Enable warnings to assist with detecting common errors.
#NoEnv ; Uyumlukuk için A_ ön eki ile ortam değişkenlerini kullanın
#Warn ; Enable warnings to assist with detecting common errors.
#NoEnv ; Uyumlukuk için A_ ön eki ile ortam değişkenlerini kullanın
#SingleInstance Force ; Sadece 1 kez açalıştırabilire
#KeyHistory 0 ; Tuş basımları loglamayı engeller
; #InstallKeybdHook ; Deneysel

SetBatchLines, -1 ; Scripti sürekli olarak çalıştırma (nromalde her saniye 10ms uyur)
ListLines, On ; Derlenen verileri loglamaz

SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.

#MaxThreadsPerHotkey, 1 ; Yanlışlıkla 2 kere buton algılanmasını engeller

Expand All @@ -45,10 +41,9 @@ if not DEBUG {
CheckForUpdate(True)
}

return

#Include, %A_ScriptDir%\lib\util\hotkeys.ahk
#Include, %A_ScriptDir%\lib\util\yemoji.ahk
#Include, %A_ScriptDir%\lib\util\emoji_menu.ahk

ExitFunc(exitReason, exitCode) {
if exitReason not in Logoff,Shutdown
Expand All @@ -58,4 +53,3 @@ ExitFunc(exitReason, exitCode) {
return 0
}
}

3 changes: 2 additions & 1 deletion src/lib/core/config.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ APP_PAGE = https://yhotkeys.yemreak.com
; -------------------------------- Data dir settings ---------------------------------
DIR_NAME := A_AppData . "\" . APP_NAME
DIR_ICON := DIR_NAME . "\Icons"
DIR_SCRIPTS := DIR_NAME . "\Scripts"

; --------------------------------- Update settings ----------------------------------
VERSION = 2.4.3.1
VERSION = 2.4.3.2
API_RELEASE = https://api.github.com/repos/yedhrab/YHotkeys/releases/latest

PATH_EXE = %DIR_NAME%\YHotkeys.exe
Expand Down
79 changes: 79 additions & 0 deletions src/lib/util/emoji_menu.ahk
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
/*
EmojiMenu.ahk uses the Hotkey combination CTRL+ALT+E to search the EmojiInsert.ahk Hotstring file.
Select the keyword, execute the Hotkey, and a menu of matching emojis pops up. Click a menu item
to insert the emoji into any UTF-8 supported document or Web page. Edit the EmojiInsert.ahk file
to change activating Hotstrings and add categories after a semicolon ( ; ).
This version of EmojiMenu.ahk captures matching records in a variable (EmojiItems), then sorts the variable
before inserting the matched items into the menu. This gives a menu in alphabetical order.
Discussed in the blog at:
https://jacksautohotkeyblog.wordpress.com/2018/07/02/put-your-emoji-hotstrings-in-a-pop-up-menu-autohotkey-trick
and other blogs.
*/

#^ş::
OldClipboard:= ClipboardAll
Clipboard:= ""
Send, ^c ; copies selected text
ClipWait 0
If ErrorLevel
{
ToolTip, 🐛 Hata oluştu,,,20
Sleep, 1000
ToolTip,,,,20
Return
}

EmojiItems := ""
Loop, read, %DIR_SCRIPTS%\yemoji.ahk
{
If InStr(A_LoopReadLine,Trim(Clipboard)) and (A_LoopReadLine ~= "::")
{
Emoji := StrSplit(A_LoopReadLine , ":")
Icon := StrSplit(Emoji[6], ";")
EmojiItems := EmojiItems . Emoji[4] . " | " . Trim(Icon[1]) . "`n"
}
}
Sort, EmojiItems, U

ItemCount := 0
Loop, Parse, EmojiItems , `n
{
If ItemCount = 20
{
Menu, EmojiMenu, add, % A_LoopField, InsertEmoji, +BarBreak
ItemCount := 1
}
Else
{
Menu, EmojiMenu, add, % A_LoopField, InsertEmoji
ItemCount++
}

}

If ItemCount
{
Menu, EmojiMenu, Show
; After selection or cancelation, the script deletes the menu.
Menu, EmojiMenu, DeleteAll
}
Else {
ToolTip, 😢 Emoji bulunamadı,,,19
Sleep, 1000
ToolTip,,,,19
}

; Restore the old Clipboard contents.
Clipboard := OldClipboard
Return

InsertEmoji:

EmojiIcon := StrSplit(A_ThisMenuItem , "|")

SendInput, % Trim(EmojiIcon[2])

Return

0 comments on commit 11f2d61

Please sign in to comment.