getttpos

Retrieve the display status, position, and size of the VT window in Tera Term. (version 5.3 or later)

Format

getttpos <showflag> <window x> <window y> <window width> <window height> <client x> <client y> <client width> <client height>

Parameters

Integer variable <showflag>
The display status of the VT window is stored.
0 : Normal
1 : Minimized (Iconified)
2 : Maximized
3 : Hidden
Integer variable <window x>
The X coordinate of the top-left corner of the window area is stored.
Integer variable <window y>
The Y coordinate of the top-left corner of the window area is stored.
Integer variable <window width>
The width of the window area is stored.
Integer variable <window height>
The height of the window area is stored.
Integer variable <client x>
The X coordinate of the top-left corner of the client area is stored.
Integer variable <client y>
The Y coordinate of the top-left corner of the client area is stored.
Integer variable <client width>
The width of the client area is stored.
Integer variable <client height>
The height of the client area is stored.

Return Value

System variable <result>
If the information retrieval is successful, the value 0 is stored.
If it fails, the value -1 is stored.

Remarks

The units for coordinates, width, and height are pixels.
The origin (0,0) refers to the top-left corner of the main display (primary display).
The window area refers to the entire application window, while the client area refers to the text display area excluding the title bar, menu bar, frame etc from the window area.
If the VT window is in a minimized or hidden state, the stored values for coordinates, width, and height are incorrect.
If the MACRO is not linked to Tera Term, it will result in a macro error and the execution of the macro will be temporarily paused.

Example

testlink
if result > 0 then
  :start
  getttpos showflag w_x w_y w_width w_height c_x c_y c_width c_height
  if showflag != 3 then
    if showflag = 1 then
      showtt 1
      goto start
    endif
    setdlgpos c_x c_y
    sprintf2 str 'x=%d, y=%d, width=%d, height=%d' c_x c_y c_width c_height
    messagebox str 'Client Area'
  endif
endif

See also