Advertisement
Guest User

Untitled

a guest
Aug 19th, 2019
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.78 KB | None | 0 0
  1. ;;;;; FUNCTIONS ;;;;;
  2. Fn_ToggleSwitch() {
  3. oldDev := VA_GetDevice()
  4. oldDevName := VA_GetDeviceName(oldDev)
  5. Loop
  6. {
  7. dev := VA_GetDevice("playback:" A_Index)
  8. if (dev = 0 and A_Index = newDevIndex)
  9. {
  10. newDevIndex = 1
  11. }
  12. if (dev != 0)
  13. {
  14. devName := VA_GetDeviceName(dev)
  15. if (devName = oldDevName)
  16. {
  17. newDevIndex := A_Index+1
  18. }
  19. }
  20. } Until dev = 0 or A_Index > 10
  21. newDev := VA_GetDevice("playback:" newDevIndex)
  22. newDevName := VA_GetDeviceName(newDev)
  23. VA_SetDefaultEndpoint("playback:" newDevIndex, 0)
  24.  
  25. icoFile := Fn_GetIco()
  26. ; SplashImage, %icoFile%, b2 zh150 zw-1, , %newDevName%
  27. Fn_SplashImageGUI(icoFile, "Center", "Center", 500, True, newDevName)
  28.  
  29. Sleep, 750
  30. SplashImage, Off
  31.  
  32. Menu, Tray, Icon, %icoFile%,,1
  33.  
  34. Return
  35. }
  36.  
  37. Fn_GetIco() {
  38. dev := VA_GetDevice()
  39. devName := VA_GetDeviceName(dev)
  40. ico := "computer"
  41. If RegExMatch(devName,"LG")
  42. ico := "monitor"
  43. If RegExMatch(devName,"HyperX")
  44. ico := "headset"
  45. ; MsgBox %devName%
  46. ; MsgBox, changing ico %ico% %A_WorkingDir%
  47. icoFile := A_WorkingDir "\Lib\Ico\" ico ".ico"
  48. ; MsgBox %icoFile%
  49. Return icoFile
  50. }
  51.  
  52. Fn_Speak() {
  53. Global selectedText := Sb_GetSelected()
  54. status := TTS(VoiceObj, "GetStatus")
  55. ;ToolTip % status
  56. If (status != "finished")
  57. {
  58. TTS(VoiceObj, "Stop")
  59. Return
  60. }
  61. Else
  62. {
  63. Fn_UpdateVoiceIni(VoiceObj)
  64. TTS(VoiceObj, "ToggleSpeak", selectedText) ; select some text and press F1
  65. Return
  66. }
  67. }
  68.  
  69. Fn_UpdateVoiceIni(VoiceObj) {
  70. IniRead, rate, Voice.ini, Section, Rate
  71. IniRead, voice, Voice.ini, Section, Voice
  72. TTS(VoiceObj, "SetRate", rate)
  73. TTS(VoiceObj, "SetVoice", voice)
  74. }
  75.  
  76. Fn_SwapVoice() {
  77. Global togVN := !togVN
  78. if (togVN) {
  79. IniWrite, "Microsoft Zira Desktop", Voice.ini, Section, Voice
  80. } else {
  81. IniWrite, "Microsoft David Desktop", Voice.ini, Section, Voice
  82. }
  83. Return
  84. }
  85.  
  86. Fn_VoiceFaster() {
  87. IniRead, rate, Voice.ini, Section, Rate
  88. rate := rate+1
  89. if (rate > 10)
  90. {
  91. rate := 10
  92. }
  93. IniWrite, % rate, Voice.ini, Section, Rate
  94. Return
  95. }
  96.  
  97. Fn_VoiceSlower() {
  98. IniRead, rate, Voice.ini, Section, Rate
  99. rate := rate-1
  100. if (rate < -10)
  101. {
  102. rate := -10
  103. }
  104. IniWrite, % rate, Voice.ini, Section, Rate
  105. Return
  106. }
  107.  
  108. Sb_GetSelected() { ; GetSelectedText by Learning one
  109. IsClipEmpty := (Clipboard = "") ? 1 : 0
  110. if !IsClipEmpty {
  111. ClipboardBackup := ClipboardAll
  112. While !(Clipboard = "") {
  113. Clipboard =
  114. Sleep, 10
  115. }
  116. }
  117. Send, ^c
  118. ClipWait, 0.1
  119. ToReturn := Clipboard, Clipboard := ClipboardBackup
  120. if !IsClipEmpty
  121. ClipWait, 0.5, 1
  122. Return ToReturn
  123. }
  124.  
  125. Fn_SplashImageGUI(Picture, X, Y, Duration, Transparent = false, PicText = "") {
  126. Gui, XPT99:Margin , 0, 0
  127. Gui, XPT99:Add, Picture, w150 h-1 xCenter, %Picture%
  128. Gui, XPT99:Color, White
  129. Gui, XPT99:+LastFound -Caption +AlwaysOnTop +ToolWindow +Border
  130.  
  131. Gui, TXT1:Margin , 0, 0
  132. Gui, TXT1:Font, cWhite s20 q5, Roboto
  133. Gui, TXT1:Add, Text, Center Wrap , %PicText%
  134. Gui, TXT1:Color, Black
  135. Gui, TXT1:+LastFound -Caption +AlwaysOnTop +ToolWindow +Border
  136.  
  137. If Transparent
  138. {
  139. Winset, TransColor, ECE9D8
  140. }
  141.  
  142. Gui, XPT99:Show, x%X% y%Y% NoActivate
  143. Gui, TXT1:Show, x%X% y200 NoActivate
  144. SetTimer, DestroySplashGUI, -%Duration%
  145. return
  146.  
  147. DestroySplashGUI:
  148. Gui, XPT99:Destroy
  149. Gui, TXT1:Destroy
  150. return
  151. ; ; Gui, XPT99:Margin , 0, 0
  152. ; ; Gui, XPT99:Font, s12 cRed
  153. ; ; Gui, XPT99:Add, Text, Center w800, %PicText%
  154. ;
  155. ; ; Gui, XPT99:Add, Picture, w100 h-1, %Picture%
  156. ; Gui, XPT99:Add, Picture,, %Picture%
  157. ; ; Gui, XPT99:Color, Black
  158. ; Gui, XPT99:+LastFound -Caption +AlwaysOnTop +ToolWindow -Border
  159. ;
  160. ; If Transparent
  161. ; {
  162. ; Winset, TransColor, ECE9D8
  163. ; }
  164. ; Gui, XPT99:Show, w300 x%X% y%Y% NoActivate Center
  165. ; SetTimer, DestroySplashGUI, -%Duration%
  166. ; return
  167. ;
  168. ; DestroySplashGUI:
  169. ; Gui, XPT99:Destroy
  170. ; return
  171. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement