; WinSet_Click_Through - Makes a window unclickable.
WinSet_Click_Through(I, T := "Off", S := 0) {
if WinExist("ahk_id " I) {
if (S = 1) {
WinSetAlwaysOnTop(true, "ahk_id " I)
WinSetExStyle("+0x20", "ahk_id " I)
} else {
WinSetAlwaysOnTop(false, "ahk_id " I)
WinSetExStyle("-0x20", "ahk_id " I)
}
WinSetTransparent(T, "ahk_id " I)
} else {
return 0
}
}
#SingleInstance Force
; Using the class name "Qt5QWindowIcon" for VLC window
VLCClass := "Qt5QWindowIcon" ; Correct class name for VLC
VLCTitle := "VLC media player" ; You can use the window title if needed
; Attempt to find VLC window by class name
ID := WinExist("ahk_class " VLCClass)
if (ID) {
; MsgBox "VLC window found by class!"
} else {
; If VLC is not found by class, try by title (you can use the full title if needed)
ID := WinExist("ahk_title " VLCTitle)
if (ID) {
;MsgBox "VLC window found by title!"
} else {
;MsgBox "VLC window not found!"
;ExitApp()
}
}
; Set it to 60% transparent initially
OriginalTransparency := Round(0.6 * 255)
OriginalSpecial := 1
WinSet_Click_Through(ID, OriginalTransparency, OriginalSpecial)
MyGui := Gui(, "Transparency Control")
MyGui.Add("Text",, "Transparency:")
MyGui.Add("Text", "y+25", "Click Through:")
MyGui.Add("Slider", "vTransparency ym", 60) ; The ym option starts a new column of controls.
MyGui.Add("CheckBox", "vSpecial Checked")
MyGui.Add("Button", "default", "OK").OnEvent("Click", ProcessUserInput)
MyGui.OnEvent("Close", ProcessUserInput)
ProcessUserInput()
{
Global OriginalTransparency, OriginalSpecial
Saved := MyGui.Submit() ; Save the contents of named controls into an object.
OriginalTransparency := Round(Saved.Transparency255/100)
OriginalSpecial := Saved.Special
WinSet_Click_Through(ID, OriginalTransparency, OriginalSpecial)
}
; Hotkey (Win + M) to toggle between transparent and original transparency
#m::
{
; Get the current transparency of the VLC window
if !WinExist("ahk_id" ID) {
return 0
}
CurrentTransparency := WinGetTransparent(ID)
if (CurrentTransparency != 0) {
; Set it to fully transparent (0 opacity)
WinSet_Click_Through(ID, 0, 0)
} else {
; Set it back to original transparency (60%)
WinSet_Click_Through(ID, OriginalTransparency, OriginalSpecial)
}
}
; Hotkey (Win + O) to show transparency and click through
#o::
{
WinSet_Click_Through(ID, 255, 0)
WinSet_Click_Through(ID, 255, 0)
MyGui.Show()
}
; Hotkey (Win + I) to confirm changing window to make transparent
#i::
{
TempID := WinExist("A")
TempGui := Gui(, "Ready to change window")
TempGui.Add("Text", , "Window Title: " WinGetTitle())
TempGui.Add("Text", , "Window Class: " WinGetClass())
TempGui.Add("Text", , "Process Name: " WinGetProcessName())
TempGui.Add("Button", "Default", "Proceed").OnEvent("Click", (*) => ProceedAction(TempGui, TempID))
TempGui.Add("Button", , "Cancel").OnEvent("Click", (*) => TempGui.Destroy())
TempGui.Show()
}
; Wait until the user quits (no need for a Return before OnExit)
OnExit(AppEnd)
; Main loop to keep the script running
ProceedAction(gui, TempID) {
WinSet_Click_Through(ID, "Off", 0)
Global ID
ID := TempID
gui.Destroy()
WinSet_Click_Through(ID, OriginalTransparency, OriginalSpecial)
}
AppEnd(*) {
; Restore window state to clickable and default transparency
if (ID) {
WinSet_Click_Through(ID, "Off", 0)
}
ExitApp()
}