Makes the specified window semi-transparent.

WinSetTransparent N, WinTitle, WinText, ExcludeTitle, ExcludeText



Type: Integer or String

To enable transparency, specify a number between 0 and 255 indicating the degree of transparency: 0 makes the window invisible while 255 makes it opaque.

The word "Off" (case-insensitive) may be specified to completely turn off transparency for a window. This is functionally identical to WinSetTransColor "Off", WinTitle. Specifying "Off" is different than specifying 255 because it may improve performance and reduce usage of system resources (but probably only when desktop composition is disabled).


Type: String, Integer or Object

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


Type: String

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.


Type: String

Windows whose titles include this value will not be considered.


Type: String

Windows whose text include this value will not be considered.

Error Handling

A TargetError is thrown if the window could not be found.

An OSError is thrown if the change could not be applied.


For example, to make the task bar transparent, use WinSetTransparent 150, "ahk_class Shell_TrayWnd". Similarly, to make the classic Start Menu transparent, see example #2. To make the Start Menu's submenus transparent, also include the script from example #3.

Setting the transparency level to 255 before using "Off" might avoid window redrawing problems such as a black background. If the window still fails to be redrawn correctly, see WinRedraw for a possible workaround.

The ID of the window under the mouse cursor can be retrieved with MouseGetPos.

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

WinSetTransColor, Win functions, Control functions


Makes Notepad a little bit transparent.

WinSetTransparent 200, "Untitled - Notepad"

Makes the classic Start Menu transparent (to additionally make the Start Menu's submenus transparent, see example #3).

DetectHiddenWindows True
WinSetTransparent 150, "ahk_class BaseBar"

Makes all or selected menus transparent throughout the system as soon as they appear. Note that although such a script cannot make its own menus transparent, it can make those of other scripts transparent.

SetTimer WatchForMenu, 5

    DetectHiddenWindows True  ; Might allow detection of menu sooner.
    if WinExist("ahk_class #32768")
        WinSetTransparent 150  ; Uses the window found by the above line.

Demonstrates the effects of WinSetTransparent and WinSetTransColor. Note: If you press one of the hotkeys while the mouse cursor is hovering over a pixel that is invisible as a result of TransColor, the window visible beneath that pixel will be acted upon instead!

#t::  ; Press Win+T to make the color under the mouse cursor invisible.
    MouseGetPos &MouseX, &MouseY, &MouseWin
    MouseRGB := PixelGetColor(MouseX, MouseY)
    ; It seems necessary to turn off any existing transparency first:
    WinSetTransColor "Off", MouseWin
    WinSetTransColor MouseRGB " 220", MouseWin

#o::  ; Press Win+O to turn off transparency for the window under the mouse.
    MouseGetPos ,, &MouseWin
    WinSetTransColor "Off", MouseWin

#g::  ; Press Win+G to show the current settings of the window under the mouse.
    MouseGetPos ,, &MouseWin
    Transparent := WinGetTransparent(MouseWin)
    TransColor := WinGetTransColor(MouseWin)
    ToolTip "Translucency:`t" Transparent "`nTransColor:`t" TransColor