-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun-run-lintalistAHK-main.py
88 lines (65 loc) · 2.95 KB
/
run-run-lintalistAHK-main.py
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
# this file will be (hopefully merged to) ...-all.py
# writeAllFile_from_main_defs(path)
if doPopupNotify_howItWorks:
popupNotify_howItWorks("doPopupNotify_howItWorks is set TRUE\n in the ..config.py file. Great :)")
if doPopupNotify_welcomeAtEachRun:
popupNotify("doPopupNotify_welcomeAtEachRun")
pass
if doBeepsWelcomeAtEachRun:
popupNotify("doBeepsWelcomeAtEachRun")
beeps() # beeps(duration=.8, freq=1500, loops=2)
# popupNotify_howItWorks(path + 'run-run-lintalistAHK-all.py')
(clipboardKey, doReplace, timeValueForBREAKLoopInSec, timeValueInLoopInSec, first_title) = read_keyword(doReplaceIfPrefixIsThis,do_ifNoPrefix_useFocusedWord_pasteResultRight,keyboard,window,clipboard)
for x in range(0, 900): # default is 25
if timeValueForBREAKLoopInSec < x * timeValueInLoopInSec:
popupNotify_howItWorks("BREAK at Loop %s because timeValueForBREAKLoopInSec > '%s'" % (str(x), str(timeValueForBREAKLoopInSec)))
break
if window.get_active_title() == first_title:
popupNotify("active_title == first_title ==> we are back")
break
time.sleep(timeValueInLoopInSec)
try:
cNew = clipboard.get_clipboard() # found here: https://github.com/autokey/autokey/wiki/Scripting#create-new-abbreviation
cNew = cNew.strip(' \t\n\r')
except:
time.sleep(0.1)
len_clipboardNew = len(str(cNew))
clipboardKey = clipboardKey.lstrip()
if len_clipboardNew < 1 or cNew == clipboardKey:
popupNotify_howItWorks("no new result ==> exit")
exit() # quit()
# [email protected] Sebastian
if doReplace: # :test :test :test :test :test 20-08-22 16:02:21
keyboard.send_keys('<ctrl>+v') # work without problem print(" ")
time.sleep(0.2) # 200mili needed in some apps 20-08-24 17:18:48
select_text(keyboard, len_clipboardNew)
popupNotify_howItWorks("do replace because Prefix " + doReplaceIfPrefixIsThis + " is found.")
# beeps(duration=.8, freq=1500, loops=2)
quit()
if doPopupNotify_howItWorks:
popupNotify_howItWorks("result = " + cNew)
# beeps(duration=.8, freq=1500, loop [email protected] : : [email protected] [email protected] [email protected] [email protected]
# loopss=5)
popupNotify_howItWorks("no Prefix " + doReplaceIfPrefixIsThis + " in " + clipboardKey )
# keyboard.send_keys('<right><left>') # deselect :uff
if do_ifNoPrefix_useFocusedWord_pasteResultRight:
keyboard.send_keys('<right>') # <right>
if do_ifNoPrefix_useFocusedWord_pasteResultNewLine:
keyboard.send_keys('<right><enter>') # <right>
else:
time.sleep(0.2)
keyboard.send_keys(" ")
# print(" ")
time.sleep(0.2)
keyboard.send_keys('<ctrl>+v') # work without problem print(" ")
time.sleep(0.1) # <== its needet
if do_ifNoPrefix_useFocusedWord_pasteResultNewLine:
time.sleep(0.1)
keyboard.send_keys('<shift>+<home>')
else:
# time.sleep(0.1)
# keyboard.send_keys('<ctrl>+<left>')
keyboard.send_keys('<ctrl>+<shift>+<left>') # right
keyboard.release_key('<shift>') # sometimes i got hanging shift key
# 200 line
time.sleep(1)