Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;;;;; FUNCTIONS ;;;;;
- Fn_ToggleSwitch() {
- oldDev := VA_GetDevice()
- oldDevName := VA_GetDeviceName(oldDev)
- Loop
- {
- dev := VA_GetDevice("playback:" A_Index)
- if (dev = 0 and A_Index = newDevIndex)
- {
- newDevIndex = 1
- }
- if (dev != 0)
- {
- devName := VA_GetDeviceName(dev)
- if (devName = oldDevName)
- {
- newDevIndex := A_Index+1
- }
- }
- } Until dev = 0 or A_Index > 10
- newDev := VA_GetDevice("playback:" newDevIndex)
- newDevName := VA_GetDeviceName(newDev)
- VA_SetDefaultEndpoint("playback:" newDevIndex, 0)
- icoFile := Fn_GetIco()
- ; SplashImage, %icoFile%, b2 zh150 zw-1, , %newDevName%
- Fn_SplashImageGUI(icoFile, "Center", "Center", 500, True, newDevName)
- Sleep, 750
- SplashImage, Off
- Menu, Tray, Icon, %icoFile%,,1
- Return
- }
- Fn_GetIco() {
- dev := VA_GetDevice()
- devName := VA_GetDeviceName(dev)
- ico := "computer"
- If RegExMatch(devName,"LG")
- ico := "monitor"
- If RegExMatch(devName,"HyperX")
- ico := "headset"
- ; MsgBox %devName%
- ; MsgBox, changing ico %ico% %A_WorkingDir%
- icoFile := A_WorkingDir "\Lib\Ico\" ico ".ico"
- ; MsgBox %icoFile%
- Return icoFile
- }
- Fn_Speak() {
- Global selectedText := Sb_GetSelected()
- status := TTS(VoiceObj, "GetStatus")
- ;ToolTip % status
- If (status != "finished")
- {
- TTS(VoiceObj, "Stop")
- Return
- }
- Else
- {
- Fn_UpdateVoiceIni(VoiceObj)
- TTS(VoiceObj, "ToggleSpeak", selectedText) ; select some text and press F1
- Return
- }
- }
- Fn_UpdateVoiceIni(VoiceObj) {
- IniRead, rate, Voice.ini, Section, Rate
- IniRead, voice, Voice.ini, Section, Voice
- TTS(VoiceObj, "SetRate", rate)
- TTS(VoiceObj, "SetVoice", voice)
- }
- Fn_SwapVoice() {
- Global togVN := !togVN
- if (togVN) {
- IniWrite, "Microsoft Zira Desktop", Voice.ini, Section, Voice
- } else {
- IniWrite, "Microsoft David Desktop", Voice.ini, Section, Voice
- }
- Return
- }
- Fn_VoiceFaster() {
- IniRead, rate, Voice.ini, Section, Rate
- rate := rate+1
- if (rate > 10)
- {
- rate := 10
- }
- IniWrite, % rate, Voice.ini, Section, Rate
- Return
- }
- Fn_VoiceSlower() {
- IniRead, rate, Voice.ini, Section, Rate
- rate := rate-1
- if (rate < -10)
- {
- rate := -10
- }
- IniWrite, % rate, Voice.ini, Section, Rate
- Return
- }
- Sb_GetSelected() { ; GetSelectedText by Learning one
- IsClipEmpty := (Clipboard = "") ? 1 : 0
- if !IsClipEmpty {
- ClipboardBackup := ClipboardAll
- While !(Clipboard = "") {
- Clipboard =
- Sleep, 10
- }
- }
- Send, ^c
- ClipWait, 0.1
- ToReturn := Clipboard, Clipboard := ClipboardBackup
- if !IsClipEmpty
- ClipWait, 0.5, 1
- Return ToReturn
- }
- Fn_SplashImageGUI(Picture, X, Y, Duration, Transparent = false, PicText = "") {
- Gui, XPT99:Margin , 0, 0
- Gui, XPT99:Add, Picture, w150 h-1 xCenter, %Picture%
- Gui, XPT99:Color, White
- Gui, XPT99:+LastFound -Caption +AlwaysOnTop +ToolWindow +Border
- Gui, TXT1:Margin , 0, 0
- Gui, TXT1:Font, cWhite s20 q5, Roboto
- Gui, TXT1:Add, Text, Center Wrap , %PicText%
- Gui, TXT1:Color, Black
- Gui, TXT1:+LastFound -Caption +AlwaysOnTop +ToolWindow +Border
- If Transparent
- {
- Winset, TransColor, ECE9D8
- }
- Gui, XPT99:Show, x%X% y%Y% NoActivate
- Gui, TXT1:Show, x%X% y200 NoActivate
- SetTimer, DestroySplashGUI, -%Duration%
- return
- DestroySplashGUI:
- Gui, XPT99:Destroy
- Gui, TXT1:Destroy
- return
- ; ; Gui, XPT99:Margin , 0, 0
- ; ; Gui, XPT99:Font, s12 cRed
- ; ; Gui, XPT99:Add, Text, Center w800, %PicText%
- ;
- ; ; Gui, XPT99:Add, Picture, w100 h-1, %Picture%
- ; Gui, XPT99:Add, Picture,, %Picture%
- ; ; Gui, XPT99:Color, Black
- ; Gui, XPT99:+LastFound -Caption +AlwaysOnTop +ToolWindow -Border
- ;
- ; If Transparent
- ; {
- ; Winset, TransColor, ECE9D8
- ; }
- ; Gui, XPT99:Show, w300 x%X% y%Y% NoActivate Center
- ; SetTimer, DestroySplashGUI, -%Duration%
- ; return
- ;
- ; DestroySplashGUI:
- ; Gui, XPT99:Destroy
- ; return
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement