WinSetTransColor()

Auto Hotkey

WinSetTransColor

Makes all pixels of the chosen color invisible inside the target window, which allows the contents of the window behind it to show through. If the user clicks on an invisible pixel, the click will "fall through" to the window behind it.

WinSetTransColor Color N , WinTitle, WinText,  ExcludeTitle, ExcludeText
Command  Example: WinSetTransColor "White", "A"
Function Example: WinSetTransColor("White", "A")

Parameters

Color [N]

Specify a color name or RGB value (see the color chart for guidance, or use PixelGetColor in its RGB mode). To additionally make the visible part of the window partially transparent, append a space (not a comma) followed by the transparency level (0-255). For example: WinSet, TransColor, EEAA99 150, WinTitle.

WinTitle

A window title or other criteria identifying the target window. See WinTitle.

WinText

If present, this parameter must be a substring from a single text element of the target window (as revealed by the included Window Spy utility). Hidden text elements are detected if DetectHiddenText is ON.

ExcludeTitle

Windows whose titles include this value will not be considered.

ExcludeText

Windows whose text include this value will not be considered.

Known Limitations for Transparent and TransColor:

  • They have no effect on a window that lacks a caption (title bar) and lacks the always-on-top property. For GUI windows, this can be solved by removing the caption only after making the window transparent. Alternatively, the following properties allow transparency to take effect: Gui -Caption +ToolWindow.
  • Setting "Transparent" to 255 prior to turning it off might avoid window redrawing problems such as a black background. If the window still fails to be redrawn correctly, see Redraw for a possible workaround.
  • To change a window's existing TransColor, it may be necessary to turn off transparency before making the change.

Tip: To make the task bar transparent, use WinSet, Transparent, 150, ahk_class Shell_TrayWnd. Similarly, to make the Start Menu transparent, follow this example:

DetectHiddenWindows, on
WinSet, Transparent, 150, ahk_class BaseBar  ; To make the Start Menu's submenus transparent, also include the script below.

To make all or selected menus on the entire system transparent, keep a script such as the following always running. Note that although such a script cannot make its own menus transparent, it can make those of other scripts transparent:

#Persistent
SetTimer, WatchForMenu, 5
return  ; End of auto-execute section.

WatchForMenu:
DetectHiddenWindows, on  ; Might allow detection of menu sooner.
IfWinExist, ahk_class #32768
    WinSet, Transparent, 150  ; Uses the window found by the above line.
return

Remarks

ErrorLevel is not changed by this command except where indicated above.

Although transparency is supported on Windows 2000/XP or later, retrieving the current transparency settings of a window is possible only on Windows XP or later (via WinGet).

Window titles and text are case sensitive. Hidden windows are not detected unless DetectHiddenWindows has been turned on.

Related

WinGet, WinHide, WinSetTitle, WinMove, WinActivate, Control

Examples

WinSetTransColor, White, Untitled - Notepad ; Make all white pixels invisible.