hello. i have a code that toggles the alwaysontop state of an active window. it works perfectly fine except that when i use "tooltip()" instead of "tooltip" i get an error. do i something wrong with the code?
thanks in advance
CODE:
^NumpadDot:: {
LastActiveWindowStatus := WinGetExStyle("A") ; Gets the ExStyle of the last active window and stores it in a variable (LastActiveWindowStatus). ExStyle is a hexadecimal number representing the extended style of a window. This is basically used to identify whether the window is AlwaysOnTop or not.
LastActiveWindowTitle := WinGetTitle("A") ; Gets the title of the last active window and stores it in a variable (LastActiveWindowTitle).
if (LastActiveWindowStatus & 0x8){ ; 0x8 is WS_EX_TOPMOST. If the LastActiveWindowStatus is & 0x8, aka if it's AlwaysOnTop, proceed
ToolTip("Turning " LastActiveWindowTitle "'s`nAlwaysOnTop OFF", 100, 150) ; Creates a ToolTip to indicate that AlwaysOnTop will be turned OFF.
AlwaysOnTopToolTipVar := WinGetPID("ahk_class tooltips_class32") ; Gets the AHK_PID of the tooltip and stores it in a variable (AlwaysOnTopToolTipVar)
WinMove(840, 730, , , "ahk_pid " AlwaysOnTopToolTipVar) ; Moves the tooltip using its AHK_PID to a location on the taskbar (since we can't usually have tooltip coordinates on the taskbar)
WinSetAlwaysOnTop(-1, "A") ; Toggles the window's AlwaysOnTop to OFF.
SetTimer(ToolTip(), -2000) ; Will remove the tooltip after 2 seconds
}
if !(LastActiveWindowStatus & 0x8){ ; 0x8 is WS_EX_TOPMOST. If the LastActiveWindowStatus is not & 0x8 (notice the "!" before the If statement), aka if it's NOT AlwaysOnTop, proceed
ToolTip(LastActiveWindowTitle "'s AlwaysOnTop`nis turned ON", 100, 145) ; Creates a ToolTip to indicate that AlwaysOnTop will be turned ON.
AlwaysOnTopToolTipVar := WinGetPID("ahk_class tooltips_class32") ; Gets the AHK_PID of the tooltip and stores it in a variable (AlwaysOnTopToolTipVar)
WinMove(840, 730, , , "ahk_pid " AlwaysOnTopToolTipVar) ; Moves the tooltip using its AHK_PID to a location on the taskbar (since we can't usually have tooltip coordinates on the taskbar)
WinSetAlwaysOnTop(-1, "A") ; Toggles the window's AlwaysOnTop to ON.
}
}
thanks in advance
Statistics: Posted by marypoppins_1 — 57 minutes ago