-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSave New Words.ahk
70 lines (62 loc) · 1.25 KB
/
Save New Words.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
; alt+shift+control+s 灵格斯单词放入生词本
!+^S::
; 调出灵格斯窗口
WinGet, activeProcess, ProcessName, A
if (activeProcess!="Lingoes64.exe" && activeProcess!="Lingoes.exe")
{
send {F10}
WinActivate, Lingoes; ahk_class Afx:000000013F860000:0
;sleep, 100 ;毫秒
;WinGet, activeProcess, ProcessName, A
;if (activeProcess!="Lingoes64.exe" && activeProcess!="Lingoes.exe")
;{
; SoundPlay, *48
; return
;}
if (ErrorLevel==1)
{
SoundPlay, *48
return
}
}
; 获取单词
ControlGetText, word, Edit1, A
if (word=addedWord) ;不重复添加单词
{
SoundPlay, *48
return
}
; 调出生词本
WinGet, p_s, ProcessName, 生词本 ahk_class #32770
if (!p_s || p_s!="Newword.exe")
Run "C:\Program Files (x86)\Kingsoft\PowerWord PE\Newword.exe"
else
WinActivate, 生词本 ahk_class #32770
WinWait, 生词本 ahk_class #32770
;打开添加生词窗口
send ^+A
WinWait, 添加单词 ahk_class #32770,,
if (ErrorLevel==1)
{
SoundPlay, *48
return
}
;send ^v
ControlSetText, Edit1, %word%, 添加单词 ahk_class #32770
counter=10
sleepTime=100
while counter>0
{
sleep %sleepTime%
ControlGetText, explain, Edit3, A
if (!explain)
{
counter:=counter-1
sleepTime:=sleepTime+100
}
else
counter=0
}
send {Enter}
addedWord=%word%
return