Plugin windows.spf

File: windows.spf
Author: Nicholas Nemtsev, Valery Kondakoff
Description: Additional words, providing a capability to monitor hidden windows (e.g. those hidden by command WIN-HIDE:), minimized windows and topmost windows. Control of windows' transparency (Win2000/XP). Special word for detecting the 'non-responding' windows.

New words:


<window_handle> MINIMIZED?

Returns TRUE only if the specified window is currently minimized.

Example:

\ restore minimized window
WIN-EXIST: "*Internet Explorer"
    IF 
        WIN-HWND MINIMIZED?
        IF
            WIN-RESTORE: "*Internet Explorer"
        THEN
    THEN

<window_handle> TOPMOST?

Returns TRUE if the specified window is currently topmost (displayed over all other windows).

Example:

#( test_topmost
\ toggle specified window topmost/notopmost status using hotkey
WatchHotKey: "$q"
Action:
    WIN-EXIST: "*Notepad*"
    IF
        WIN-HWND TOPMOST? 
        IF
            WIN-NOTOPMOST: "*Notepad*"
        ELSE
            WIN-TOPMOST: "*Notepad*"
        THEN
    THEN
)#

<window_handle> VISIBLE?

Returns FALSE if the window was processed by WIN-HIDE command or minimized to the system tray. Otherwise, returns TRUE.

Example:

\ show window if it was hidden
WIN-EXIST: "*Internet Explorer"
    IF 
        WIN-HWND VISIBLE? 0=
        IF
            WIN-SHOW: "*Internet Explorer"
        THEN
    THEN

WIN-NOT-RESPOND: "win_pattern"

This word is used to detect the 'non-responding' windows. It returns FALSE (0) if the window is working correcty and TRUE if the window 'hangs' and stops responding to user requests. You can test the WIN-NOT-RESPOND: word using a small utility HungTest, which can 'imitate' the non-responding window.

Example:

#( test_not_responding
NoActive
Action:
WIN-NOT-RESPOND: "Hanging application"
    IF
        MSG: "Not responding!"
    ELSE
        MSG: "Responding!"
    THEN
)#

There also exists a postfix version of this word:

S" *Notepad" WIN-NOT-RESPOND

WIN-TRANSPARENCY: "win_pattern" <transparency_level>

This word is used to control "transparency" of windows matching a specified mask (except for console windows). The transparency level is specified in numbers ranging from 0 (window is not transparent, flag LAYERED is off) to 255 (window is completely transparent).
Restarting a window will cancel the effect of WIN-TRANSPARENCY:.

Word WIN-TRANSPARENCY: will only work in operating systems which support window transparency, i.e. Windows 2000/XP. Note, please, the Windows XP Service Pack 2 does not allows the word WIN-TARSPARENCY: to work correctly if nnCron is launched as a system service (not as an ordinary application).

Example:

\ making a window of Notepad half-transparent:
WIN-TRANSPARENCY: "*Notepad" 50
\ making a window of Notepad completely transparent:
\ it still exists on the screen, but it is invisible:
WIN-TRANSPARENCY: "*Notepad" 255
\ canceling the effect of  WIN-TRANSPARENCY:
WIN-TRANSPARENCY: "*Notepad" 0

There also exists a postfix version of this word:

S" *Notepad" 50 WIN-TRANSPARENCY