forked from rcmaehl/WhyNotWin11
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreader.au3
104 lines (101 loc) · 2.91 KB
/
reader.au3
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
#include-once
#include "jfw.au3"
#include "sapi.au3"
;este es un script para los lectores de pantalla. this is a script for screen readers.
;Autor: Mateo Cedillo.
Func speaking($text)
Local $speak = IniRead(@ScriptDir & "\config\config.st", "accessibility", "Speak Whit", "")
Select
Case $speak = "Sapi"
speak($text, 3)
Case $speak = "JAWS"
JFWSpeak($text)
Case Else
autodetect()
EndSelect
EndFunc ;==>speaking
Func autodetect()
If ProcessExists("JFW.exe") Then
IniWrite(@ScriptDir & "\config\config.st", "accessibility", "Speak Whit", "JAWS")
EndIf
If Not ProcessExists("JFW.exe") Then
IniWrite(@ScriptDir & "\config\config.st", "accessibility", "Speak Whit", "Sapi")
EndIf
EndFunc ;==>autodetect
Func TTsDialog($text, $ttsString = " press enter to continue, space to repeat information.")
Local $pressed = 0
Local $repeatinfo = 0
speaking($text & @LF & $ttsString)
While 1
Local $active_window = WinGetProcess("")
If $active_window = @AutoItPID Then
Sleep(10)
;ContinueLoop
EndIf
If Not _IsPressed($spacebar) Or Not _IsPressed($up) Or Not _IsPressed($down) Or Not _IsPressed($left) Or Not _IsPressed($right) Then $repeatinfo = 0
If _IsPressed($spacebar) Or _IsPressed($up) Or _IsPressed($down) Or _IsPressed($left) Or _IsPressed($right) And $repeatinfo = 0 Then
$repeatinfo = 1
speaking($text & @LF & $ttsString)
EndIf
If Not _IsPressed($control) And _IsPressed($c) Then $pressed = 0
If _IsPressed($control) And _IsPressed($c) And $pressed = 0 Then
ClipPut($text)
speaking($text & "Copied to clipboard.")
EndIf
If Not _IsPressed($enter) Then $pressed = 0
If _IsPressed($enter) And $pressed = 0 Then
$pressed = 1
speaking("ok")
ExitLoop
EndIf
Sleep(50)
WEnd
EndFunc ;==>TTsDialog
Func createTtsOutput($filetoread, $title)
Local $move_doc = 0
Local $r_file = FileReadToArray($filetoread)
Local $iCountLines = @extended
Local $not = 0
If @error Then
speaking("Error reading file...")
Else
speaking($title)
EndIf
While 1
Local $active_window = WinGetProcess("")
If $active_window = @AutoItPID Then
Else
Sleep(10)
ContinueLoop
EndIf
If Not _IsPressed($up) Then $not = 1
If _IsPressed($up) And $move_doc = 0 Then
Return $move_doc
speaking("home.")
EndIf
Sleep(15)
If Not _IsPressed($up) Then $not = 1
If _IsPressed($up) And $move_doc > 0 Then
$move_doc = $move_doc - 1
speaking($r_file[$move_doc])
EndIf
Sleep(15)
If Not _IsPressed($down) Then $not = 1
If _IsPressed($down) And $move_doc = $iCountLines Then
Return $move_doc
speaking("document end. Press enter to back.")
If Not _IsPressed($enter) Then $not = 0
If _IsPressed($enter) And $not = 0 Then
$not = 0
ExitLoop
EndIf
EndIf
Sleep(15)
If Not _IsPressed($down) Then $not = 1
If _IsPressed($down) Then ; AND $move_doc > 0 Then
$move_doc = $move_doc + 1
speaking($r_file[$move_doc])
EndIf
Sleep(15)
WEnd
EndFunc ;==>createTtsOutput