mIRC: Custom Window
Prior to mIRC 5.5, this was the main method for making a GUI (graphical user interface).
A custom window is just another window, like a channel window or a server window. The following commands allow you to modify, add, and change things in that custom window of yours.
Creating a window
you can do anything in the window of yours, you will need to actually open it. The “@” before the name is required to indicate to mIRC that this is the window's name.
/window @<WindowName> [x y [w h]]
Basic Window Commands
With the following commands you can manipulate a window in number of way:
/titlebar @window <text>
This command will change the window's title. Please Note: this will note change the actual @windowname, only its title.
/renwin <@oldname> <@newname> [topic]
This command will change the @windowname to a new @windowname. An optional title can also be specified in this command.
/aline [color] <@name> <text>
This command will simply add a line of text to the end of the window. The [color] is the color number for the line.
- -n prevents from adding duplicates
- -i indents the just added line
/cline [color] <@name> <N>
This command is used to change the color of the Nth line with the new [color].
- -m when coloring nicknames in a channel nicklist, and makes mIRC also color the nick in channel messages.
- -r reset a nickname color in a channel listbox to the default color
/dline [color] <@name> <N[-N2]>
This command is used to delete the Nth line from the window. The N2th line can be specified to give a range of line ex: 4-7 will delete line 4,5,6, and 7.
/iline [color] <@name> <N> <text>
This command allows you to add a line of text after a give Nth line. The [color] is the color number for the line.
- n prevents from adding duplicates
- i indents the just added line
/rline [color] <@name> <N> <text>
This command is used to replace the Nth line of a window with another line. The [color] is the color number for the line. /sline [color] <@name> <N>
This command is used to select the Nth line of window.
- p forces the line of text to be wrapped if it's too long to fit on one line
- h highlights the window's button if it's currently minimized
- a selects a line without clearing the current selections
- s selects the line that was just added and clears the current selections
Customizing a Window
/window -abBcCdeEfg[N]hikl[N]mnoprRsvwxz [-tN,..,N] +bdeflLmnstx <@name> [x y [w h]] [/command] [popup.txt] [font [size]] [iconfile [N]]
Yes, this is the same command as we introduced in order to create the window. Don’t be too intimidated by all the new switches
@name - is the name of the dialog
x,y,w,h - are the Left, Top, Width, Height
popup.txt - is an optional popup text file. Must be in plain text (no INI style)
/command - is the command you want to be executed when text was entred in the editbox. It is kind of ON TextEntred event.
font/size - can be specify font name and size
iconfile/N - can set a title bar icon for the custom window
Switched (First Section)
-t switches
the t switches is used to set a tab position 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
Switched (Third Section)
Identifiers $window(N/@name)
Properties Property Explanation x,y,w,h return the left, top positions, and the width and height of the window dx,dy return the left, top positions of the window 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 Boolean; returns $true if the window is mdi state returns minimized/maximized/hidden/normal title returns the text in the titlebar of the window 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 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 sbtext returns the switchbar button text sbcolor returns the switchbar highlight color sbstate returns switchbar button state for a window tbstate returns treebar button state for a window
Custom Window's Menu
There are two ways of making a menu:
- Plain text file (POPUP.TXT) which contains the menu
- Coding the menu in the remote section
The first option i mentioned is using a popup file, this method is very much like a popup in the script editor.
in the following example we will close the window on right click close window: (remember: if you place the code in the popup file, you do not need to put the MENU { } block)
CloseWindow: { window -c $active }
The other option i said is using the remote section to code it. In order to tell mIRC in what window to place the menu, we will start the block using the following code: menu @WindowName {
CloseWindow: { window -c $active } ;mouse ... ;sclick ... ;dclick ... ;uclick .... ;rclick ... ;lbclick ... ;leave ... ;drop ... }
Example
This example will demonstrate how to use a custom window. All this example does is write everything everyone says in that windows.
ON *:TEXT:*:#: { window @EveryThing aline @EveryThing $chr(3) $+ 5[ $+ $chr(3) $+ 2 $+ $chan $+ $chr(3) $+ 5] $chr(3) $+ 5< $+ $chr(3) $+ 10 $+ $nick($chan,$nick).pnick $+ $chr(3) $+ 5> $+ $chr(3) $+ 1 $1- window -g1 @EveryThing } Menu @EveryThing { Close Window: { window -c $active } }