-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathScript_1 not recommend, simplified
652 lines (536 loc) · 19.8 KB
/
Script_1 not recommend, simplified
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
; Quick typing and text editing version 1, easy to use and understand, but not as responsive as script 2.
; use like any other AHK script.
;这个脚本控制着语言切换和快速输入数学符号,两个功能。 使用方法:可以直接新建 txt,然后更名为 xxx.ahk,复制全部代码,运行即可使用。说明见 readme
;-------------------------------------------------------------------------------------------------------------
;Environment settings 环境设置
#NoEnv
#Warn
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
;Tracking variable settings 环境设置
global Current_IME_State:= 1 ;✨1 is Eng, 2 is Chinese, (IMEs are too complicated and way too bloated to extract the key info we need, so we better track the states by ourself. )✨
global Current_IME_Is_half_width:= 0 ;✨ "1" is full-width input mode, "0" is normal. ✨
global using_keyboard_controlling_mouse:=0
global using_shift_to_help_typing_in_Chinese:=1
global n_mouse_move_momentum:=0
global Caps_Times:= 0 ; 没啥用,这里可以删。用几个变量为脚本增加一些功能,但是这些功能都太复杂,例如点 3 次某个键, 点 4 次某个键,触发什么什么功能,需要变量来记录。但最后我都删了,因为自己都记不住。
global StartTime:= 0
SetCapsLockState, AlwaysOff
;-------------------------------------------------------------------------------------------------------------
;自定义短语 αβγδκλμνξπρρστυφχψωθ
;( ⁰ ¹ ² ³ ⁴ ⁵ ⁶ ⁷ ⁸ ⁹ ⁺⁻⁼ ⁽ ⁾ ₀ ₁ ₂ ₃ ₄ ₅ ₆ ₇ ₈ ₉ ₊ ₋ ₌ ₍ ₎ ),
;a full superscript Latin lowercase alphabet except q ( ᵃ ᵇ ᶜ ᵈ ᵉ ᶠ ᵍ ʰ ⁱ ʲ ᵏ ˡ ᵐ ⁿ ᵒ ᵖ ʳ ˢ ᵗ ᵘ ᵛ ʷ ˣ ʸ ᶻ ),
;a limited uppercase Latin alphabet ( ᴬ ᴮ ᴰ ᴱ ᴳ ᴴ ᴵ ᴶ ᴷ ᴸ ᴹ ᴺ ᴼ ᴾ ᴿ ᵀ ᵁ ⱽ ᵂ ),
;a few subscripted lowercase letters ( ₐ ₑ ₕ ᵢ ⱼ ₖ ₗ ₘ ₙ ₒ ₚ ᵣ ₛ ₜ ᵤ ᵥ ₓ ),
;and some Greek letters ( ᵅ ᵝ ᵞ ᵟ ᵋ ᶿ ᶥ ᶲ ᵠ ᵡ ᵦ ᵧ ᵨ ᵩ ᵪ ).
#UseHook On
; https://en.wikipedia.org/wiki/Beta_Code
; 详情如何使用请见 https://github.com/scullion/greek.ahk/blob/master/greek.ahk
; 简单地说,字母加esc 底下的撇号,例如c~ 会自动变成 ξ ,a~ 变成α ,G~大写 shift g ` 变成 Γ
#Hotstring EndChars `t``
; 上一句话将 空格触发变成了 tab 和 撇好触发 hotstring。 例如 hotstring 是 a,那么 a~ (加的撇号)会变成 α , k~ κ l~ λ 见 ahk 的官网, #Hotstring EndChars -()[]{}:;'"/\,.?!`n `t 结束符设置什么都行。
; 添加o 代表最后的撇号、Tab会被省略。
; 添加C 代表区分大小写,这样能完整的映射希腊大小写。
:oC:a::α ; lower case alpha
:oC:b::β ; lower case beta
:oC:c::ξ ; lower case xi
:oC:d::δ ; lower case delta
:oC:e::ε ; lower case epsilon
:oC:f::φ ; lower case phi
:oC:g::γ ; lower case gamma
:oC:h::η ; lower case eta
:oC:i::ι ; lower case iota
:oC:k::κ ; lower case kappa
:oC:l::λ ; lower case lambda
:oC:m::μ ; lower case mu
:oC:n::ν ; lower case nu
:oC:o::ο ; lower case omicron
:oC:p::π ; lower case pi
:oC:q::θ ; lower case theta
:oC:r::ρ ; lower case rho
:oC:s::σ ; lower case sigma
:oC:t::τ ; lower case tau
:oC:u::υ ; lower case upsilon
:oC:w::ω ; lower case omega
:oC:x::χ ; lower case chi
:oC:y::ψ ; lower case psi
:oC:z::ζ ; lower case zeta
; ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩ
:oC:A::Α ; capital alpha
:oC:B::Β ; capital beta
:oC:C::Ξ ; capital xi
:oC:D::Δ ; capital delta
:oC:E::Ε ; capital epsilon
:oC:F::Φ ; capital phi
:oC:G::Γ ; capital gamma
:oC:H::Ε ; capital eta
:oC:I::Ι ; capital iota
:oC:K::Κ ; capital kappa
:oC:L::Λ ; capital lambda
:oC:M::Μ ; capital mu
:oC:N::Ν ; capital nu
:oC:o::Ο ; capital omicron
:oC:P::Π ; capital pi
:oC:Q::Θ ; capital theta
:oC:R::Ρ ; capital rho
:oC:S::Σ ; capital sigma
:oC:T::Τ ; capital tau
:oC:U::Υ ; capital upsilon
:oC:W::Ω ; capital omega
:oC:X::Χ ; capital chi
:oC:Y::Ψ ; capital psi
:oC:Z::Ζ ; capital zeta
;加入 10ms 延迟,对慢速的电脑来说,输入长字符串不会出现问题。
:ok10:-::━━━━━━
:ok10:par:: ∂
:ok10:partial:: ∂
:ok10:divider:: /
:ok10:fraction:: ⁄ ; 1⁄1 2/2 3/3 注意三种除法的区别,第三种可读性最高。
:ok10:fra::⁄
:ok10:int:: ∫
:ok10:integral:: ∫∬∭⨌∱⨑∲∳ ∮∯∰
:ok10:sets::϶∀∁∃∄∅∈∉∵∴ ⎲⎳⌠⌡
:ok10:inf:: ∞
:ok10:infinity:: ∞
:ok10:neq:: ≠
:ok10:sqrt:: √
:ok10:half:: ½
:ok10:quater:: ¼
:ok10:plusminus:: ±
:ok10:plmi:: ±
:ok10:12:: ½
:ok10:14:: ¼
:ok10:variesas::∝
:ok10:nabla::𝛁 ;nabla 是 电磁场中常用的运算符。
:ok10:del::𝛁 ;nabla 又叫 del
:ok10:sum:: Σ ;大写 s 加 撇号也行。
:ok10:vec:: ⃗ ;vector 向量箭头 可能显示不出来
:ok10:email::[email protected]
:ok10:mima::john_cena
:ok10:qq::1410046075
:ok10:shouji::888-646-5693
:ok10:dizhi::Cardi B c/o KSR Group, LLC 244 Fifth Ave Suite K261 New York,
:ok10:k4::circa-2006
:ok10:k6::Imma let you know
:ok10:sfz::[email protected]
:ok10:jiji::基极
:ok10:jidianji::集电极
:ok10:bji:: 基极
:ok10:cji:: 集电极
:ok10:eji:: 发射极
:ok10:gji:: 栅极
:ok10:dji:: 漏极
:ok10:sji:: 源极
;⁰ ¹ ² ³ ⁴ ⁵ ⁶ ⁷ ⁸ ⁹ ⁺⁻⁼ ⁽ ⁾ 上标 superscript
Esc & 0::⁰
Esc & 1::¹
Esc & 2::²
Esc & 3::³
Esc & 4::⁴
Esc & 5::⁵
Esc & 6::⁶
Esc & 7::⁷
Esc & 8::⁸
Esc & 9::⁹
; 很难去按组合热键, 三个键的组合键,esc+ shift + = 不等于 esc+ "+", doesn't work
Esc & \::⁺
Esc & f9::⁺
Esc & f10::⁻
Esc & f11::ᐧ
Esc & f12::/
Esc & ,::≤ ;less than
Esc & .::≥ ;greater than
F1 & f9::+
F1 & f10::-
F1 & f11::×
F1 & f12::÷
Esc & -::⁻
Esc & =::⁼
Esc & [::⁽
Esc & ]::⁾
;abcd=>>ᵃᵇᶜᵈᵉᶠᵍʰⁱʲᵏˡᵐⁿᵒᵖʳˢᵗᵘᵛʷˣʸᶻ 上标 superscript
Esc & a::ᵃ
Esc & b::ᵇ
Esc & c::ᶜ
Esc & d::ᵈ
Esc & e::ᵉ
Esc & f::ᶠ
Esc & g::ᵍ
Esc & h::ʰ
Esc & i::ⁱ
Esc & j::ʲ
Esc & k::ᵏ
Esc & l::ˡ
Esc & m::ᵐ
Esc & n::ⁿ
Esc & o::ᵒ
Esc & p::ᵖ
Esc & r::ʳ
Esc & s::ˢ
Esc & t::ᵗ
Esc & u::ᵘ
Esc & v::ᵛ
Esc & w::ʷ
Esc & x::ˣ
Esc & y::ʸ
Esc & z::ᶻ
;-------------₀ ₁ ₂ ₃ ₄ ₅ ₆ ₇ ₈ ₉ ₊ ₋ ₌ ₍ ₎ 下标 subscript
F1 & 0::₀
F1 & 1::₁
F1 & 2::₂
F1 & 3::₃
F1 & 4::₄
F1 & 5::₅
F1 & 6::₆
F1 & 7::₇
F1 & 8::₈
F1 & 9::₉
; 很难去按组合热键, 三个键的组合键,f1+ shift + = 不等于 f1+ "+", doesn't work
F1 & \::₊
F1 & -::₋
F1 & =::₌
F1 & [::₍
F1 & ]::₎
;abcd=>>ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓ 下标 subscript
F1 & a::ₐ
F1 & e::ₑ
F1 & h::ₕ
F1 & i::ᵢ
F1 & j::ⱼ
F1 & k::ₖ
F1 & l::ₗ
F1 & m::ₘ
F1 & n::ₙ
F1 & o::ₒ
F1 & p::ₚ
F1 & q::ᵅ ;α
F1 & r::ᵣ
F1 & s::ₛ
F1 & t::ₜ
F1 & u::ᵤ
F1 & v::ᵥ
F1 & x::ₓ
F1 & z::Send,ᴬ ᴮ ᴰ ᴱ ᴳ ᴴ ᴵ ᴶ ᴷ ᴸ ᴹ ᴺ ᴼ ᴾ ᴿ ᵀ ᵁ ⱽ ᵂ ᵅ ᵝ ᵞ ᵟ ᵋ ᶿ ᶥ ᶲ ᵠ ᵡ ᵦ ᵧ ᵨ ᵩ ᵪ ;三个组合键的代码不好写,请各位自己铺开快捷键。
;→ ←↑↓ ┷ ┯⟾⟹⟺ ⟸
Esc & Up::↑
Esc & Down::↓
Esc & Left::←
Esc & Right::→
F1 & Up::⟺
F1 & Down::≝
F1 & Left::⟸
F1 & Right::⟾
F1 & /::⁄
Esc & /::⁄
F2 & l::Send,ℒ ; laplace transform
F2 & f::Send,ℱ ; Fourier transform
F2 & z::Send,𝒵 ; Z transform
F2 & x::Send,X̅ ; capital X bar
F3 & a::Send,Ā
F3 & b::Send,B̅
F3 & c::Send,C̅
F3 & d::Send,D̅
F3 & x::Send,x̅X̅ ; x bar
F3 & y::Send,y̅Ȳ ; y bar
F3 & u::Send,∪ ;union
F3 & i::Send,∩ ;intersection
:ok10:bars::A̅ B̅ C̅ D̅ a̅ b̅ c̅ d̅ α̅ β̅ γ̅ δ̅ ε̅ x̅ X̅ y̅ ĀāḆḇḎḏĒēḠḡH̱ẖĪīḴḵḺḻṈŌōṞṟṮṯŪūX̱x̱ȲȳẔẕ
Insert & Space::
Esc & Space::Send,{⠀} ;insert blank that you can't see, but still can be underlined.
:ok10:fx::f(x)
:ok10:Fx::F(x)
:ok10:fx'::f'(x)
:ok10:fx''::f⁽²⁾(x)
:ok10:fx2::f(x)²
:ok10:shuyu:: x ∈ (0,∞) ;belong 属于
:ok10:nb::🐮🍺
;最后一点忠告,千万不要修改tab的功能,很影响使用!
Insert & s:: ;求和 双行 Summation double line formula prefab
Send, ⎲ ∞ xⁿ⁺² +{Enter}⎳n=0 n ᐧ (n{+}2)
Sleep,600
Send,{Up}
Sleep,100
Send,{Space 12}{⠀}
Sleep,100
Send,{Home}{Right 8}{Shift down}{End}{Shift up}
Sleep,500
Send ^u
return
Insert & i::Send, ⌠x f(u) du =+{Enter}⌡0 x ᐧ (x{+}2) ;积分 integral formula prefab
Insert & 1:: ;下划线 underline formula prefab
Send,{Space 6}{1}{Space 6}{⠀} ;insert blanks . finally I can underline in Onenote, thank god.
Sleep,100
Send,{Home}{Right 8}{Shift down}{End}{Shift up}
Sleep,500
Send ^u
return
;√ ∞ Σ ∫ ⇑ ⇒ ⇓ ⇐ ↔⇔→⇒
;≠≡≈≝≤≥ ∂
;∞∘∫∫∂∮∯∇ ◠◡
;__⭜ ‾‾⭝ ⮨⮪⮩⮫⮬⮭⮮⮯ some arraw donesn't show in text editor, but it's ok in web browser and notebook.
;🠬 🠮 🠭 🠯 ⇐⇑⇒⇓⇔⇕⇖⇗⇘⇙
;⯬⯭⯮⯯ ⬎⬏⬐⬑ ⟹ ⇑
;;⮠ ⮢ ⮡ ⮣ ⮥⮤ ⮧ ⮦ ◜◟◝◞
;↑↓←→↖↙↘↗ → ←↑↓
;⟵⟶⟷⟸⟹⟺⟻⟼⟽⟾┷┯┠ ┨ ╋ ━ ┃
; ╲╱╱╲
; ←←here is zero-width space, is it cool? it's there but you can't seem it.
;∫ x² ∫ x² ∫ a²
;∫━━━━━━━━━━ =∫━━━━━━━━━━━ +∫ ━━━━━━━━━━━
;∫ x² ∫√(x²+a²) ∫ √(x²+a²)
;:sets::϶∀∁∃∄∅∈∉∵∴ ⎲⎳⌠⌡
Esc::Send,{Esc} ; keep basic functions
F2::Send,{F2} ;
F1::Send,{F1} ;
;--------------------------------------------------------------------------------------------------------------------------------------------------
; 我试了很多种 增强大写锁定切换语言的方法,其中第三种最好用:
; 方法一:指定语言
; 方法二:轮流切换 ctrl+shift 切换语言。
; 方法三:√ 目前脚本使用的: 使用cap 瞬间短按是轮流切换、较短是英文、长按对应中文。同时,还支持指定切换: cap+R、F、B是中、英、大写指定切换。
;其他功能:
;代码中 IME = 0 是 英文,1 是中文。
CapsLock::
KeyWait, CapsLock
TimeLength := A_TimeSinceThisHotkey
;MsgBox, The BackSpace key has been held down for %TimeLength%ms
if( A_PriorKey = "Capslock" ){ ;我的 Cap键绑定了很多功能,例如还有 cap+w 这种组合键,不幸的是这种写法会有干扰,不加处理的话,会同时触发 cap+w 和 切换语言的功能。所以需要判断有没有其他按键按下,如果没有,再切换语言。实现方法是这个系统变量 prior key,这个变量的名字是固定的,不用加%%来表示他是变量。
if (TimeLength < 200) {
Function_Set_Language(9) ;翻转中英文。
}
else if (TimeLength < 400) { ;(英文的按键时长要 大于 200 且 小于400ms,中文 <1000ms)
Function_Set_Language(1) ; 2中文,1 英文 ;para in : Current_IME_State "9" to toggle, "1" to English, "2" to Chinese,
SoundBeep, 3000, 100 ;频率3000hz,时长100ms
}
else if (TimeLength < 1000) {
Function_Set_Language(2) ; 2中文, 1 英文
SoundBeep, 1790, %TimeLength% ;频率1790hz,时长是你按下去大写的时间。
}
else {
Send,{LButton}
}
}
else {
ToolTip, 您使用了其他组合键,将不触发切换语言功能。 , 100, 150
}
if(Current_IME_State==1){
ToolTip, The IME is English `n You have been holding CapsLock %TimeLength%ms 。`n , 1500, 500 ; I doesn't know why it suddenly wouln't work.
}
else{
ToolTip, 输入法为中文状态 `n 您按住大写锁定键时长%TimeLength% 毫秒 。`n , 1600, 550 ; I doesn't know why it suddenly wouln't work.
}
SetTimer, RemoveToolTip, -1000
return
CapsLock & B::SetCapsLockState, AlwaysOn
CapsLock & n::SetCapsLockState, On
CapsLock & m::SetCapsLockState, Off
CapsLock & [::Function_Set_Language(2) ;切换并指定为中文 para in : Current_IME_State "9" to toggle, "1" to English, "2" to Chinese,
CapsLock & ]::Function_Set_Language(1) ;切换并指定为英文
CapsLock & p::Func_toggle_Full_half_width(9) ;全半角切换
;wordpress增强功能。
CapsLock & -:: ;上标 superscript
CapsLock & T::
SC027 & T::
Send,{Shift down}{Left}{Shift up}
Send,{Ctrl down}{Shift down}={Shift up}{Ctrl up}
Send,{Left}
return
; esc 在我的脚本里是上标的意思,F1 对应下标很好记。更简单的选择是,直接使用上下标的 unicode码。¹²³₁₂₃
CapsLock & =:: ;下标 subscript
CapsLock & G::
SC027 & G::
CapsLock & F1::
Send,{Shift down}{Left}{Shift up}
Send,{Ctrl down}={Ctrl up}
Send,{Left}
return
SC027 & Enter::
CapsLock & Enter::Send,+{Enter}
;-------------------------------------------------------------------------------------------------------------
; Mouse move and click
CapsLock & Up::function_my_mouse_momentum(0,-1)
CapsLock & Left::function_my_mouse_momentum(-1,0)
CapsLock & Down::function_my_mouse_momentum(0,1)
CapsLock & right::function_my_mouse_momentum(1,0)
CapsLock & Ctrl::Send,{LButton}
CapsLock & Numpad0::Send,{RButton}
function_my_mouse_momentum(x,y){ ;↑ y<0 ← x<0 ↓ y>0 → x>0
if(A_TimeSincePriorHotKey<150){
n_mouse_move_momentum += 15
}
else{
n_mouse_move_momentum=32
}
MouseMove, x*n_mouse_move_momentum, y*n_mouse_move_momentum, 100, R
;GetKeyState, state, Capslock
;vari_a:=GetKeyState("Up")
;ToolTip, %vari_a% , 100, 150
;if (state = "D")
; ToolTip, %state% , 100, 150
}
;-------------------------------------------------------------------------------------------------------------
;分号用作打字法加强,上下左右移动键,翻页加强、删除。
;分号 semicolon 不是常用按键,需要一个特殊的编码"SC027"。
+SC027::Send,{:} ;保护";"原来的功能
*SC027::Send,{SC027} ;保护";"原来的功能
;-------------------------------------------------------------------------------------------------------------
;moving Insertion point functions;
;move I-beam horizontally and vertically with "←↓↑→ hjkl".
;move I-beam and selecting
; VIM use following setting, the whole set is too complicated, I just use the "←↓↑→ hjkl"
;h – Moves the cursor left. j – Moves the cursor down. k – Moves the cursor up. l – Moves the cursor right. CapsLock & 2::
; by the way VIM is too hard to learn and has practical situation to use. VIM 太难学了/用不上。
CapsLock & j::
SC027 & j::Send,{Left}
CapsLock & k::
SC027 & k::Send,{Down}
CapsLock & i::
SC027 & i::Send,{Up}
CapsLock & l::
SC027 & l::Send,{Right}
;multiple key mapped to one function for clumpsy hands and easier to memory .
; srat of line / end of line
CapsLock & z::
SC027 & z::Send,{Home}
CapsLock & c::
SC027 & c::Send,{End}
CapsLock & w::
SC027 & w::Send,{Up}
CapsLock & a:: ;previous word
SC027 & a::Send,{Ctrl down}{Left}{Ctrl up}
CapsLock & s::
SC027 & s::Send,{Down}
CapsLock & d::
SC027 & d::Send,{Ctrl down}{Right}{Ctrl up}
CapsLock & q::
SC027 & q::Send,^{backspace} ;delete a word
CapsLock & e::
SC027 & e::Send,^{delete} ;delete a word after I-beam.
CapsLock & r::
SC027 & r::Send,^{z} ;redo
;1→delete, `→backward delete
CapsLock & u::
SC027 & u::Send,{BackSpace}
CapsLock & o::
SC027 & o::Send,{Delete}
;------------------- select texts--------------
; a little enhance ( basiclly not useful)
SC027 & Left::Send,{Shift down}{Ctrl down}{Left}{Ctrl up}{Shift up} ;
SC027 & Down::Send,{Shift down}{Down}{Shift up}
SC027 & Up::Send,{Shift down}{Up}{Shift up}
SC027 & Right::Send,{Shift down}{Ctrl down}{Right}{Ctrl up}{Shift up}
CapsLock & Backspace::
SC027 & Backspace::delete_one_line() ;自定义的函数
;-------------------------------------------------------------------------------------------------------------
Insert & Tab::Send,{Home} {Down} ;添加四个全角空格,缩进,顺便换一行
Insert & delete::func_wordpress_change_to_soft_enter()
Insert & End::Send,{Down}{End} ;配合使用软回车、换行
Insert & ]::SetTimer, Right_func, 1500
Insert & [::SetTimer, Left_func, 1500
;------------------------------ functions -----------------------
;wordpress 文字修改,这个是添加软回车,wordpress 需要一整块的文字,
func_wordpress_change_to_soft_enter(){
Send,{End}
Sleep, 50
Send,{delete}
Sleep, 50
Send,{Shift down}{Enter}{Shift up}{End}
return
}
Right_func:
Send,{Right}
return
Left_func:
Send,{Left}
return
;Abandoned
;CapsLock & c::
;using_shift_to_help_typing_in_Chinese:=using_shift_to_help_typing_in_Chinese=1?0:1
;ToolTip, 开关shift功能,用 shift 组合键帮忙打中文。`n 当前状态%using_shift_to_help_typing_in_Chinese%, 100, 150
;SetTimer, RemoveToolTip, -5000
;return
;clipboard text replace, failing function. 暂时放弃,处理剪切板里的文字挺麻烦的。
;SC027 & m::replace_enter_to_soft_enter() ;
;replace_enter_to_soft_enter(){ ;这个有点问题,字符串替换不行,函数不能用。
;SoundBeep, 3000, 100 ;频率3000hz,时长100ms
;Send {Ctrl Down}c{Ctrl Up}
;Clipboard := StrReplace(Clipboard, "`r`n", "xxxxx")
;Send {Ctrl Down}v{Ctrl Up}
;return
;}
;toggle insert mode with notification. But insert mode in win 10 is not usable; only old software support it. In Office Word you need to go to option and turn it on.
Capslock & Insert::
GetKeyState, InsertState, Insert, T
If InsertState = U ;If insert is off
{
MsgBox, 260, , Are you sure you want to enable insert?, 5
}
If InsertState = D ;If insert is on
{
MsgBox, 4, , Are you sure you want to disable insert?, 5
}
IfMsgBox No
return
else IfMsgBox Timeout
return
Else
Send {Insert}
return
delete_one_line(){
Send,{Home}{Shift down}{End}{Shift up}
Sleep,1
Send,{BackSpace} ;删除一行,而不是删除所有文字,功能挺顺手的。
return
}
Func_flip_IME_state(){
;Func_alt_shift()
Func_ctrl_space() ; for most of people
;Send,{Ctrl}
}
; 用系统的切换语言
Func_alt_shift(){
Send, {Alt down}{Shift}{Alt up}
}
Func_ctrl_shift(){
Send, {Ctrl down}{Shift}{Ctrl up}
return 0
}
; 用 ime的切换语言,
Func_ctrl_space(){
Send, {Ctrl down}{Space}{Ctrl up}
return 0
}
;全角半角切换。
Func_flip_Full_width(){
Send, +{Space}
return 0
}
; This is simple enough. We track IME state by ourself.
; If the state in the program doesn't synchronize to the real IME state, just make them the same using mouse clicks.
;para in : Current_IME_State "9" to toggle, "1" to English, "2" to Chinese,
;para out: no output, everything is stored in global varibles.
Function_Set_Language(target_state) {
SetCapsLockState, AlwaysOff ;turn off Captitals
Func_toggle_Full_half_width(0) ;turn off Full-width characters.
if ( target_state <>Current_IME_State ){ ; 9 ≠ 1 and 9 ≠ 2 ,一定会接环只有想要切换的语言和当前语言不同的时候才切换。
Func_flip_IME_state()
Current_IME_State := 3-Current_IME_State ;jump between 1,2
}
else{ ;nothing changes
}
Return 0
}
;(for ascii art)
; para in : Current_IME_Is_half_width: "0" for normal and "1" to Full-width Unicode .
;para out: no output, everything is stored in global varibles.
Func_toggle_Full_half_width(target_HF){
if ( target_HF <>Current_IME_Is_half_width ){
Func_flip_Full_width()
Current_IME_Is_half_width := 1-Current_IME_Is_half_width ;jump between 0,1
}
else{ ;nothing changes
}
Return 0
}
RemoveToolTip:
ToolTip
return