mIRC Scripting
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
Well, before 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.
Basic Window Commands
With the following commands you can manipulate a window in number of way:
This command will change the window's title. Please Note: this will note change the actual @windowname, only its title.
This command will change the @windowname to a new @windowname. An optional title can also be specified in this command.
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
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
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.
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
This command is used to replace the Nth line of a window with another line. The [color] is the color number for the line.
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
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) | |
| Switch | Explanation |
| -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 | single-line editbox |
| -E | multi-line editbox |
| -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 highlight for a window button, 0 = none, 1 = message color, 2 = highlight 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 |
| -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 |
| -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 |
-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) |
|
| Switch | Explanation |
| -b | border |
| -d | no border |
| -e | 3d edge |
| -f | dialog frame |
| -l | tool window |
| -L | tool window (will not show up in taskbar) |
| -n | minimize |
| -s | sizeable |
| -t | title bar |
| -x | maximize |
Identifiers
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)
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:
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.
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 }
}

