Custom Windows This miniFAQ written by: DataHntr @ #mIRC-Scripts (Parts of this document were copied from the mIRC help file) Last Updated on 4:18 PM 5/5/97 * Syntax : /window [-abcdelnorsx] <@name> [x y [w h]] [/command] [popup.txt] [font [size]] * [] items enclosed in square brackets are optional. * <> items enclosed in arrows are required. You can specify the following switches and parameters either when first creating a window or to manipulate an existing window. * Can only be used when initially creating a window. ** Can be used when initially creating a window, or after its creation to modify its position. *** Cannot be used when initially creating a window, but can be used after its creation to modify it. a = activate window ** Activates the window. Activate means bring it to the front, on top of all other windows, and make it the active window. The opposite of this is the -n switch, which minimizes, but does not close the window. b = update horizontal scrollbar width for listbox ** If your list box is small enough or has enough items to have a scroll bar along the side, this switch will make that scroll bar grow larger or smaller, in proportion to the amount of data in this window. This switch is ONLY valid for windows opened with the -l switch. c = close window *** Closes @name completely. d = open as desktop window * mIRC supports opening windows as desktop windows, windows which appear in the Taskbar or as an icon on the desktop, in Windows 3.1 . This switch creates such a window. e = editbox * Opens a window along with an edit box, similar in appearance to the majority of windows. The edit box is a place for the user to type commands in. l = listbox * Creates a window which has selectable rows, similar to the URL Catcher window and Notify window. n = minimize window ** Minimizes the window. If it's a desktop window, it becomes an icon. If it is a window inside mIRC, it becomes an icon in mIRC's taskbar. This switch, -x and -r are mutually exclusive. o = if opened on desktop, place ontop * Places the window on top of the other windows, and makes it float above all other windows. This switch only works when initially creating a custom window, and cannot be used to change a window from desktop to inside mIRC and/or vice versa. Must be used with the -d switch, otherwise, it is ignored. r = restore window ** Restores an in-mIRC window which was minimized, or made full-screen, to its original dimensions. This flag does NOT work on desktop windows. This switch and -n are mutually exclusive. s = use a sorted list * Used with the -l switch, sorts the list automatically. x = maximize window ** Enlarges the window to the largest possible size. This switch, -n and -r are mutually exclusive. @name window name (must prefix with a @) All custom windows MUST begin with an @ sign. x,y,w,h left top width height The left, top, width and height of the custom window, as measured in pixels. The number of pixels to inches depends on your resolution and monitor. In 800x600 resolution, 100 pixels is about an inch. popup.txt popup filename, loaded when needed (must be a plain non-ini text file) The name of a file that will be loaded as a menu whenever the right mouse button is clicked on in your custom window. This argument can be replaced with a menu definition, which will be discussed later. /command default command (executed whenever you enter text in an editbox) This command appears as if the user had typed it, similar to the dedicated query window. font/size font name and size (defaults to status window font) Example, Arial 15 changes font to Arial, 15 pt text. You cannot change the text size for a single line. Commands: The following commands allow you to manipulate the lines in a custom window. /aline <@name> add line to list /dline <@name> delete Nth line /iline <@name> insert line at Nth line /rline <@name> replace Nth line /sline <@name> select Nth line Note: /sline can ONLY be used on listbox windows (windows opened with the -e switch) You can specify a line colour number before the window name for text windows. You can also specify the -s switch for /aline, /iline, and /rline to select the line that was just added, or if you want currently selected lines to remain selected you can specify the -a switch instead. * Identifiers: The following identifiers return custom window information. $window(N).x left window position $window(N).y top window position $window(N).w width of window $window(N).h height of window $window(N).state minimized/maximized/normal $line(@name,N) returns Nth line $sline(@name,N) returns Nth selected line (listbox only) $sline(@name,N).ln returns the line number of the Nth selected line (listbox only) * Examples: /window @test This would create a window named @test with all of the default settings. /window -a @test Activates an already created @test window. /window -n @test Minimizes it. * Menus: There are two ways to load menus for a custom window in mIRC. One is by using a popup file, the other by using what are known as menu definitions. Popup files: A popup file for a custom menu consists of a text file with NO INI sections, in other words, a plain ASCII file. This file looks identical to the view of the popups area in mIRC. MyPopups .Kick This User: kick #mychan $line(@mywindow,1) .Ban This User: ban #mychan $line(@mywindow,1) 3 .Kick And Ban This User: kick #mychan $line(@mywindow,1) | ban #mychan $line(@mywindow,1) 3 The above is a valid file to use as a popup.txt for a custom window. Menu Definitions: Menu definitions are one of the newest features of mIRC's remote. This allows scripters to add to any menu from within the remote, without writing directly to a loaded popup INI, or /loading one separately. This allows for easy integration of scripts into mIRC, and into other scripts, if used correctly. This is how menu definitions are written. menu mymenu { dclick { ignore -p $line(@mywindow,1) } MyPopups .Kick This User: kick #mychan $line(@mywindow,1) .Ban This User: ban #mychan $line(@mywindow,1) 3 .Kick And Ban This User: kick #mychan $line(@mywindow,1) | ban #mychan $line(@mywindow,1) 3 } Looks a lot like the text file version, doesn't it? But what's dclick? dclick stands for double click, which you use to define what happens if a user double clicks on an entry in a custom window. In the above menu, double clicking would ignore the user specified. *** $line(@mywindow,1) returns the first line in an imaginary @mywindow. $$1 does not work in custom windows. Menu definitions are placed in a remote file, and appear side by side with events, commands, raw, and aliases in the remote. on 1:JOIN: menu mymenu { ctcp 1:PAGE: alias myalias . . . . . Using your menu definition with your custom window: To use a menu definition with a custom window, you should initialize (create with the /window command) it like this: /window @nameofwindow mymenu In this case, a menu which appears like this: on 1:JOIN: menu mymenu { ctcp 1:PAGE: in your remote, would be used for @nameofwindow. * Frequently Asked Questions: Q. What kind of code can be put in dclick? A: Any code you want. It can be multiline, it can deal with the window data, it can ignore the window data, it can change the window data. Q. How can I put my menu in a user's nicknames list, or menubar? A: Name your menu nicklist , to put it in the nicknames popup. Name your menu channel, to put it in the channel popup. Name your menu query, to put it in the query/chat popup. Name your menu menubar, to put it in the menubar popup. Name your menu status, to put it in the status window popup. Q. Do menu items have to be unique? A: Menu items do not have to be unique, but it does make sense to make them unique. Q. Can I name my menu definitions the same as someone else? A: See above. Q. Can I make my menu definitions appear instead of the ones the user has? A: You can't control where an item appears, in relation to other items in the menu, whether by the person's popups.ini or other scripts, unless your script adds it. If your script adds more than one menu item, they appear in the order you have them in your script. You can't replace popups.ini items with menu definitions, or menu definitions with menu definitions. Q. I want my double click to use the dclick item in my menu definition! A: You can't override the doubleclick function in a nicknames list using dclick. Example: menu nicklist { dclick { echo -a blah } <-- this dclick will do nothing. My Popups . . . } Q. Is there an if command for if a certain window already exists? A: You can use if $window(name).state != $null. ==