jfwscripts/deezer/Deezer.JSS

71 lines
2 KiB
JavaScript
Executable file

; Copyright TheAdam <theadam.eu> 2025
; Deezer script to enjoy music smoother!
include "HJConst.jsh"
include "HJGlobal.jsh"
include "HJHelp.jsh"
include "common.jsm"
include "Chrome.jsh"
include "Chrome.jsm"
import "UIA.jsd"
globals
; These two variable required to access globaly the two important window handles
Handle hWndGlob,
Handle hWndStart
Script ScriptFileName()
ScriptAndAppNames("Deezer")
EndScript
void function autoStartEvent()
; run only once to focus when focus moved to Deezer APP
; Enumerate over the subwindows and stop when we'll find the Chrome Legacy Window
; This needed to focus to the webapp as by default the JAWS moves the focus to the banner
If (EnumerateChildWindows(GetParent (hWndStart), "IterWindows") == false)
; Set focus to the window
SetFocus(hWndGlob)
EndIf
endFunction
int function IterWindows(handle hwnd)
; Iterate over the banner's parent's childs
;This needed because banner and webapp are on the same level
Var
string WindowTitle
WindowTitle = GetWindowName(hwnd)
; We store the handle in this global variable to access it in the init function
hwndGlob = hwnd
;Stop when we found the Chrome Legacy Window
If StringContains(WindowTitle, "Chrome Legacy Window")
return False
else
return True
EndIf
endFunction
void function ProcessEventOnFocusChangedEventEx(
handle hwndFocus, int nObject, int nChild,
handle hwndPrevFocus, int nPrevObject, int nPrevChild,
int nChangeDepth, string sClass, int nType)
; Handle focus changes
; We need only once to set up the handle of the webapp
;This handle is the banner and the init script uses the parent handle to start iterate over the childs
hWndStart = hwndFocus
ProcessEventOnFocusChangedEventEx(hwndFocus, nObject, nChild,hwndPrevFocus, nPrevObject, nPrevChild,nChangeDepth, sClass, nType)
EndFunction
script ControlDownArrow ()
; Decrease volume
typeKey (cksControlDownArrow)
endScript
script ControlUpArrow ()
; Increase volume
typeKey (cksControlUpArrow)
endScript