-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathaddPhrase1.ahk
134 lines (105 loc) · 3.22 KB
/
addPhrase1.ahk
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
; Generated by AutoGUI 2.6.2 启动显示窗口
#SingleInstance Force
#NoEnv
#NoTrayIcon
#Include phrase.ahk
#Include, function.ahk
;#Include sogou.ahk
;
fatherTVMap := {}
;sonTVMap := {}
;phrase := {}
;import("phrase.ahk",fatherTVMap,sonTVMap,phrase)
for key, element in fatherMap{
if(!fatherTVMap.HasKey(element)){
p1 := TV_Add(element)
fatherTVMap[element] := p1
}
TV_Add(key,fatherTVMap[element])
}
Gui Main1: New, +LabelMain +hWndhMainWnd +Resize -MinimizeBox
Menu, tray, noicon
Menu ContextMenu, Add, &Open...`tCtrl+O, import
Menu ContextMenu, Icon, &Open...`tCtrl+O, shell32.dll, 4
Gui Add, Text, x10 y10 w350 h25, %abbreL%
Gui Add, Edit, hWndhEdtValue vabbre x10 y35 w250 h25
IniRead, fatherText, setting.ini, folder, default
if(fatherText == ""){
fatherText := myPhraseL
}
Gui Add, Text, hWndhTxtText2 vTxtText1 x10 y65 w80 h25, %folderL%
;Gui Add, Edit, hWndhEdtValue vfather x80 y65 w120 h25, self
Gui Add, ComboBox, vfather x80 y65 w120, %fatherText%||
Gui Add, Text, hWndhTxtText2 vTxtText2 x10 y100 w80 h25, %descriptionL%
Gui Add, Edit, hWndhEdtValue vdescription x80 y100 w120 h25
Gui Add, Text, hWndhTxtText2 vTxtText4 x10 y130 w120 h25, %shortCutL%
Gui Add, DropDownList, vColorChoice x80 y130 w120, ]||
Gui Add, Text, hWndhTxtText3 vTxtText3 x10 y155 w250 h25, %supportL%
Gui Add, Edit, vvalue x10 y180 w600 h200,%Clipboard%
Gui Add, Button, gaddPhraseHandle1 x440 y390 w80 h25, %addL%
Gui Add, Button, x530 y390 w80 h25 gcancel1, %cancelL%
for key, value in fatherTVMap{
GuiControl, , father, %key%
}
Menu sogou, Add, Sogou, MenuHandler
Menu FileMenu, Add, import, :sogou
;Menu MenuBar, Add, &File, :FileMenu
Menu help, Add, %documentL%, HelpMenuHandler
Menu help, Add, %sysShortcutL%, SysShortcutLMenuHandler
Menu MenuBar, Add, &%helpL%, :help
Gui Menu, MenuBar
Gui Show, w620 h420, %addPhraseL%
import:
Return
MenuHandler:
importSogo()
Return
HelpMenuHandler:
runDocument()
Return
SysShortcutLMenuHandler:
runSysShortcut()
Return
addPhraseHandle1(CtrlHwnd, GuiEvent, EventInfo, ErrLevel := "") {
GuiControlGet abbre
GuiControlGet value
GuiControlGet description
GuiControlGet father
father := Trim(father)
if(father == ""){
father := myPhraseL
}
result := add(abbre,value,father,description)
IniWrite, %father%, setting.ini, folder, default
if(result == 0){
reload
sendcmd("重启","start.ahk")
Sleep 200 ; 如果加载成功, reload 会在 Sleep 期间关闭当前实例, 所以永远不会执行到下面的语句.
MsgBox, 4,, The hotstring just added appears to be improperly formatted. Would you like to open the script for editing? Note that the bad hotstring is at the bottom of the script.
IfMsgBox, Yes, Edit
return
MoveCaret:
IfWinNotActive, New Hotstring
return
; 否则移动 InputBox 中的光标到用户输入缩写的位置.
Send {Home}{Right 3}
SetTimer, MoveCaret, Off
return
}
}
cancel1(CtrlHwnd, GuiEvent, EventInfo, ErrLevel := "") {
Gui hide
}
Main1Size:
If (A_EventInfo == 1) {
Return
}
Return
Main1ContextMenu:
Menu ContextMenu, Show
Return
Main1Escape:
Main1Close:
Gui hide
;ExitApp
;#Include send.ahk