Popup Menus

From Scriptwiki
Jump to: navigation, search

mIRC allows you to create custom popup menus for the status window, query/chat windows, channel windows, the channel nickname listbox, and main menubar.


A menu of this format would go in a popups file. You can access the main popup file by typine Alt+R to open the scripts editor, and clicking on the popups tab.


If you wanted to add menuitem with name 'join #help.script', which joins the channel #help.script:

join #help.script:/join #help.script

If you want submenus for some item, you'll need to put dot in front of the itemname (submenus are always under the parent menuitem):

Most used commands
.auth:/.msg Q@CServe.quakenet.org AUTH username password
.www.quakenet.org:/run http://www.quakenet.org

This would make a popup like this:


You can also create submenus for submenus with ..menutitem:commands, and ...menuitem:command and so on:

Most used commands
.auth:/.msg Q@CServe.quakenet.org AUTH username password
..Quakenet sites
...www.quakenet.org:/run http://www.quakenet.org
...script.quakenet.org:/run http://script.quakenet.org/
..Some other sites
...google:/run http://www.google.com

That would make a popup like this:


"-" works as a seperator

Menuitem1:/echo -a hello
Menuitem2:/echo -a hi there

note: You need to put dots in front of the seperator, if you want it into submenus: ..-

To use the popup menu for a channel nickname listbox, you need to select a nickname before the menu will pop up. Here is a simple nickname listbox popup menu:

Who Is?:/whois $1

You can use { } brackets to perform several commands:

test {
 var %variable = testing
 echo -a %variable

Note: To add a visible menuitem that doesn't do anything, you could do: Menuitem:/

Identifiers and Variables

Variables or identifiers that are a part of a the title of a menu definition are evaluated each time the popup appears. This allows you to create popup menus that vary in appearance. If an entire menu item evaluates to $null, it is not displayed.

;%menuitem is set to Auth
;%menucommand is set to /.msg Q@CServe.quakenet.org AUTH username password


You can't use if in popup menus, you'll need to use $iif, the next example will show menuitem "cookie", if active channel is not #help.script:

$iif($active != #help.script,cookie,):/describe $active offers a cookie to everyone!

Dynamically Created Submenus

You can use the $submenu identifier to create submenus dynamically.


By using this, $myidentifier will be called until nothing is returned by it, each time with a higher number. For example, it would be called with "begin" as $1, then "1" then "2" then "3" until nothing is returned by the alias, and then it would be called one last time with "end". Here is an example to create a submenu of all of the channels you are in.

menu nicklist,query { 
alias -l allchannels {
 if ($1 == begin || $1 == end) { return - }
 elseif ($1 isnum 1-) return $comchan($me,$1) $+ :echo -a This is my channel command.

MENU prefix

You can use menu prefix in your remote to create popup menus for channels,nicklists,chats,status window or custom windows

menu channel {
 join:/join $?

With custom windows you can use various mouse events to trigger an action:

menu @test {
 mouse:/echo mouse moved at $mouse.x $mouse.y in $active $1
 sclick:/echo single click at $mouse.x $mouse.y
 dclick:/echo double click at $mouse.x $mouse.y
 uclick:/echo mouse released at $mouse.x $mouse.y
 rclick:/echo single right-click at $mouse.x $mouse.y in $active $1
 lbclick:/echo mouse selected $active $1
 leave:/echo mouse left $leftwin $leftwinwid
 drop:/echo drag and drop at $mouse.x $mouse.y

The mouse event is triggered when you move a mouse inside a picture window. You can use the $mouse identifier (see below) for the x and y position of the mouse. The sclick event is triggered when you click once inside a picture window. It will also trigger if you double-click. The dclick event is triggered when you double-click inside a picture window. The uclick event is triggered when a mouse button is released inside a picture window. The lbclick event is triggered when an item is selected in a listbox, either with the mouse or the cursor keys. The leave event is triggered when the mouse is moved outside the borders of a custom window. The drop event is triggered if you clicked in the window, held the button down, moved the mouse, and then let go of the button.

You can also specify multiple window names for menus

menu @window1,@test,@somewin {
 My nick is:/echo -a $me