Custom Windows


The /window command, along with a few other related commands listed below, allows you to create and manipulate custom windows. Its format is:


/window [-abBcCdDe[N]fg[N]hHij[N]k[N]l[N]mMn[N]oprRsSuvw[N]xz] [-tN,..,N] [+bdeflLnstx] <@name> [x y [w h]] [/command] [popup.txt] [font [size]] [iconfile [N]]


Switches and Parameters

You can specify the following switches and parameters either when first creating a window or to manipulate an existing window.


The first set of switches:


a        = activate window

b        = update horizontal scrollbar width for listbox

B        = prevent window from using an internal border

c        = close window

C        = center window when first created

d        = open as desktop window

D        = allows a window to be toggled between mdi and desktop

e[N]        = use editbox, where 0 = single, 1 = multi, 2 = auto, 3 = default

f        = indicates that w h are the required width and height of the text display area as opposed to the window size

g[N]        = sets/removes hilight for a window button, 0 = none, 1 = message color, 2 = hilight color

h        = hide window (window only appears in Window menu)

H        = enables auto-hide for a side-listbox

i        = dynamically associate with whatever happens to be the active connection

j[N]        = sets buffer size to N lines

k[N]        = hides the @ prefix in the window name, 0 = hide prefix, 1 = show prefix

l[N]        = listbox, if N is specified then a side-listbox N characters wide is created

m        = allow line marker to be used in window

M        = chops text at tab stops.

n[N]        = minimize window, 2 = minimize without auto-expanding item in treebar

o        = if opened on desktop, place ontop

p        = creates a picture window

r        = restore window

R        = reset window position to previously saved position

s        = sort the main window, whether text or listbox

S        = sort the side-listbox

u        = remove ontop setting of a desktop window

v        = close window when associated status window is closed

w[N]        = where 0 = hide from switchbar/treebar, 1 = show in switchbar, 2 = show in treebar, 3 = show in both

x        = maximize window

z        = place window button at end of switchbar


The -t switch used to set the tab positions in a listbox.


tN,...,N        = specifies the tab positions in a listbox, if text contains tabs it will be

          spaced out according to these tab settings


Note: If -tN is 0, this enables the leading text to be hidden.


The third set of switches is used to change the appearance of a window.


b        = border

d        = no border

e        = 3d edge

f        = dialog frame

l        = tool window

L        = tool window but window will not appear in taskbar

n        = minimize box

s        = sizable

t        = titlebar

x        = maximize box


Note: Some switches may automatically turn others on/off.


@name        window name (must prefix with a @)

x,y,w,h        left top width height

popup.txt        popup filename, loaded when needed (must be a plain non-ini text file)

/command        default command (executed whenever you enter text in an editbox)

font/size        font name and size (defaults to status window font)

iconfile/N        sets the titlebar icon for a custom window


If you want the custom window to use a menu definition in a remote script, you can specify the custom window's name as the popup filename instead of an actual popup.txt filename.


Note: If you specify -1 for any of the x,y,w,h values, a default value is used, unless the window exists in which case the current value is used.



The following commands allow you to manipulate the lines in a custom window.


/aline [c] <@name> <text>        add line to list

/cline [c] <@name> <N>        changes the color of the Nth line to color C

/dline [c] <@name> <N[-N2]>        delete Nth line through N2th line

/iline [c] <@name> <N> <text>        insert line at Nth line

/rline [c] <@name> <N> <text>        replace Nth line

/sline [c] <@name> <N>        select Nth line


The c parameter specifies a color number for the line.

The -s switch selects the line that was just added and clears the current selections.

The -a switch selects a line without clearing the current selections.

The -h switch highlights the window's button if it is currently minimized.

The -p switch forces the line of text to be wrapped if it is too long to fit on one line.

The -r switch is used with /cline to reset a nickname color in a channel listbox to the default color.

The -i switch is used with /aline and /iline to indent a newly added line.

The -n switch is used with /aline and /iline to prevent a line from being added if it exists.

The -m switch is used with /cline when coloring nicknames in a channel nicklist, and makes mIRC also color the nick in channel messages.

The -l switch applies the command to the side listbox.

The -iN switch indents the line by 2 spaces by default or N spaces if N is specified.


If you are referencing a window which uses a side-listbox, you can specify the -l switch in the above commands to act on the side-listbox.


/renwin <@oldname> <@newname> [topic]

This allows you to change the name of an existing window to a different one, and an optional topic can be specified.



The following identifiers return custom window information.



Returns properties for a window.


Properties: x, y, w, h, dx, dy, dw, dh, bw, bh, mdi, title, state, font, fontsize, fontbold, fontitalic, fontcs, logfile, stamp, icon, ontop, type, anysc, wid, cid, hwnd, sbtext, sbcolor, sbstate, tbtext, tbstate, idle, lb


x,y,w,h        return the left, top positions, and the width and height of the window respectively.

dx,dy        return the left, top positions of the window relative to the desktop.

dw,dh        return the width and height of the text display area.

bw,bh        return the width and height of the bitmap for a graphic window.

mdi        returns $true if the window is mdi, otherwise returns $false

title        returns the text in the titlebar of the window

state        returns minimized/maximized/hidden/normal

font        returns the name of the current font

fontsize        returns the size of the current font

fontbold        returns $true if the font is bold, otherwise returns $false

fontitalic        returns $true if the font is italic, otherwise returns $false

fontcs        returns the character set of the current font

logfile        returns name of logfile if one is open for the window

stamp        returns timestamp setting

icon        returns on/off depending on whether icon is visible

ontop        returns ontop status for a window

type        returns window type

anysc        returns $true if the /window -i switch was specified

wid        returns the window id

cid        returns the associated connection id

hwnd        returns the window handle

sbtext        returns the switchbar button text

sbcolor        returns the switchbar highlight color

sbstate        returns switchbar button state for a window

tbtext        returns the treebar button text

tbstate        returns treebar button state for a window

idle        returns idle state

lb        returns 0, 1 or 2 depending on whether window contains no listbox, listbox or side listbox


You can also use the format $window(@wildcard,N) which returns the Nth window matching the wildcard window name.


Note: You can also get the .w and .h properties by specifying: -1 for the width and height of the screen, -2 for the main mIRC window, and -3 for the MDI window where all other windows inside mIRC are displayed.



Returns the Nth line of text in the specified window. If N is zero, it returns the total number of lines in the window.


Properties: state, color


$line(@name,1).state - returns selection state for a line in a listbox.


If you are referencing a window which uses a side-listbox, you can set T to zero to reference the display area, or set T to one to reference the side-listbox.



Returns Nth position of line which matches the specified wildcard text. If T is 1, it references the listbox, 2 implies that wildtext is a regular expression, and 3 for both.


Properties: text



Returns the Nth selected line in a listbox (only works in listboxes). If N is zero, it returns the total number of selected lines in the window.


Properties: ln


$sline(@name,N).ln        returns the line number of the Nth selected line




/window @test


This would create a window named @test with all of the default settings.


/window -els @clones 10 10 clones.txt


This would create a window with a sorted listbox and an editbox, positioned near the top left of the mIRC window, and using the popup file clones.txt which would appear whenever you click the right mouse button in the listbox.


Note: The popup text file must be plain text in a non-ini format using a non-ini extension.