1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
#SingleInstance Force
#MaxThreadsPerHotkey 1
#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
Hotkey, IfWinActive, ahk_class PCMan	;these hotkeys only work under PCMan

IniRead, PasteKey, SymbolList.ini, Setting, pasteKey, !p
IniRead, _HotKey, SymbolList.ini, Setting, hotKey, ^Enter
Hotkey, %_HotKey%, MakeWindow

;Make tray menu
Menu, tray, Icon, Symbol.ico
Menu, tray, tip, PCMan表情符號輸入工具
Menu, tray, noStandard
Menu, setting, Add, 快速鍵, setHotkey
Menu, setting, Add, 貼上鍵, setPastekey
Menu, tray, Add, 設定, :setting
Menu, tray, Add, 編輯表情符號, Edit
Menu, tray, Add
Menu, tray, Add, 關於, about
Menu, tray, Add, 結束, Exit
return

Exit:
ExitApp
return

setHotkey:
HK:=HotkeyGUI(0,_Hotkey,1,false,"設定快速鍵")	;HotkeyGUI Library
if(HK="")
	return
iniWrite, %HK%, SymbolList.ini, Setting, hotkey
hotkey, %_hotkey%, makeWindow, off
_hotkey=%HK%
hotkey, %_hotkey%, makeWindow, on
return

setPastekey:
HK:=HotkeyGUI(0,pasteKey,1,false,"設定貼上鍵")	;HotkeyGUI Library
if(HK="")
	return
pasteKey=%HK%
iniWrite, %pasteKey%, SymbolList.ini, Setting, pastekey
return

about:
Gui, -Resize
Gui, margin, 16, 12
Gui, add, text,, 這是一個用AutoHotkey寫成的小軟體。
Gui, add, text, y+23, 因為PCMan內建的表情符號輸入工具不支援
Gui, add, text, y+7, Unicode文字,於是就索性自己寫了一個功能
Gui, add, text, y+7, 較簡單但支援Unicode的符號輸入軟體。在軟
Gui, add, text, y+7, 體執行後會自動將快速鍵綁定至PCMan視窗
Gui, add, text, y+7, ,按下快速鍵就可以叫出符號輸入工具。貼
Gui, add, text, y+7, 上鍵是指PCMan中的「貼上」快速鍵--本軟
Gui, add, text, y+7, 體是以操作剪貼簿來達到與PCMan溝通的功
Gui, add, text, y+7, 能。
Gui, add, text, y+23, 有任何問題歡迎來信: [email protected]
Gui, show,, 關於
return

SendToPCMan:
Gui, Submit, Nohide
gosub, DestroyWindow
T=%clipboard%
StringReplace,ColorChoice,ColorChoice,`r
clipboard=%ColorChoice%
ControlSend,,%PasteKey%,ahk_class PCMan
clipboard=%T%
return

MakeWindow:
Gui, +Delimiter`n +Owner
Gui, +LastFound
WinSet, Disable,, ahk_class PCMan
FileRead, SymbolList, SymbolList.txt
GuiHWND := WinExist()
Gui, Font,, 細明體
Gui, Add, ListBox, vColorChoice w400 r20 choose1 gCheckInput,%SymbolList% 
Gui, Add, Button, gEdit, 編輯表情符號
Gui, Add, Button, Default Hidden x0 y0 gSendToPCMan
Gui, Show,, 快速表情符號輸入
WinWaitClose, ahk_id %GuiHWND%
return

CheckInput:
if A_GuiEvent=DoubleClick
	gosub, SendToPCMan
return

Edit:
run,SymbolList.txt
GuiClose:
GuiEscape:
gosub, DestroyWindow
return

DestroyWindow:
WinSet, Enable,, ahk_class PCMan
WinActivate,ahk_class PCMan
Gui, Destroy
return