This is the script I'm using the most. The two main issues when using right-click as modifier is the right click might lose some functionalities and context menus popping up. A workaround is to send ESC to close them. The only issue with the script below is that sending ESC is exiting full screen. Can "RButton Up" be "ignored" when the GUI exist to prevent sending ESC ? Is that something I can do to prevent this ? I would really appreciate the help, thanks.
Tested on Windows 10.
Code: Select all
#Requires AutoHotkey v2.0
#SingleInstance Force
A_MaxHotkeysPerInterval := 150
DDLPath := "C:\Windows\System32\sndvolsso.dll"
GuiVol := Gui()
hGuiVol := GuiVol.Hwnd
GuiVol.Opt("-Caption +Border +ToolWindow")
GuiVol.SetFont("s12")
GuiVol.BackColor := "101010"
GuiVol.Add("Text", "w300 Cwhite Center", "Volume")
picGuiVol := GuiVol.Add("Picture",, DDLPath)
progGuiVol := GuiVol.Add("Progress", "x+m yp+8 h20 w225 c0078D7")
textGuiVol := GuiVol.Add("Text", "x+m w25 Cwhite Center")
~RButton & WheelUp::
~RButton & WheelDown::
{
static prevVol := 0
SoundSetVolume Instr(A_ThisHotkey, "WheelDown") ? "-2" : "+2"
strGetVol := SoundGetVolume()
progGuiVol.Value := strGetVol
textGuiVol.Value := Round(strGetVol)
if (strGetVol = 0 && prevVol != "NoSound")
picGuiVol.Value := "*Icon3 " DDLPath, prevVol := "NoSound"
else if (strGetVol >=1 && strGetVol<=32) && (prevVol != "Low")
picGuiVol.Value := "*Icon4 " DDLPath, prevVol := "Low"
else if (strGetVol >=33 && strGetVol<=65) && (prevVol != "Medium")
picGuiVol.Value := "*Icon5 " DDLPath, prevVol := "Medium"
else if (strGetVol >=66 && strGetVol<=100) && (prevVol != "High")
picGuiVol.Value := "*Icon6 " DDLPath, prevVol := "High"
GuiVol.Show("NoActivate")
;~ GuiVol.Show("x" (A_ScreenWidth-430) "y" (A_ScreenHeight-150) " NoActivate")
WinSetAlwaysOnTop(1, "ahk_id " hGuiVol)
WinSetTransparent "225", "ahk_id " hGuiVol
SetTimer () => GuiVol.Hide(), "-1500"
}
#HotIf WinExist("ahk_id " hGuiVol)
RButton Up::
{
activeWin := WinGetProcessName("A")
Switch activeWin
{
Case "chrome.exe": Sleep 10
Case "msedge.exe": Sleep 40
}
Send "{Esc}"
}
#HotIf