Get window text, class name, program, set window text

Syntax

s.getwintext(window)
s.setwintext(window)
s.getwinclass(window)
s.getwinexe(window [full])

 

Parameters

s - str variable.

window - top-level or child window. Usually it is window handle.

full - if 0, get filename (e.g., "notepad"), else get full path (e.g., "C:\Windows\notepad.exe"). Default: 0.

 

Remarks

getwintext populates s with window text. It can be window title, button label, edit control text, static control text, etc.

setwintext sets window text.

getwinclass populates s with window class name.

getwinexe populates s with window executable file name or full path. Cannot get full path of a process running as other user.

 

See also: GetProcessExename

 

Example

int h
str s
h=win("Notepad")
s.getwintext(h)
h=id(15 "Notepad")
s.setwintext(h)