Project

General

Profile

Scripting Menus » History » Version 30

Per Amundsen, 01/10/2017 04:17 PM

1 14 Per Amundsen
{{>toc}}
2 1 Per Amundsen
3 14 Per Amundsen
h1. Scripting Menus
4
5 5 Per Amundsen
You can edit most AdiIRC menus in the Menu Editor located at Tools -> Edit Menus.
6 1 Per Amundsen
7
Status - Edit the status menus.
8
Channel - Edit the channel menus.
9
Query - Edit the query menus.
10
Nicklist - Edit the nicklist menus.
11
Menubar - Edit the menubar menus.
12
13 21 Per Amundsen
A menu syntax consists of <Menu text><colon><Menu command>.
14 1 Per Amundsen
15
For this reason, only one colon is allowed in a menu, neither the text nor the command can contain any other colons for the menu to work properly.
16
17
*Example*
18
19
<pre>
20
; Add a new menu item with the text "Query", when clicked, execute "/query $1" where $1 means the first word given to this menu, usually a nick.
21
Query:/query $1
22
</pre>
23
24 22 Per Amundsen
Menu commands can also contain multiple lines, if so they must be enclosed with brackets.
25
26
*Example*
27
28
<pre>
29
; Add a new menu item with the text "Query", when clicked, execute both "/query $1" and "/whois $1".
30
Query:{
31
  /query $1
32
  /whois $1
33
}
34
</pre>
35
36 14 Per Amundsen
h2. Menu prefix
37 9 Per Amundsen
38 23 Per Amundsen
The "menu" prefix can also be used in a custom script to add more items to a menu, the syntax is the same.
39 1 Per Amundsen
40
*Example*
41
42
<pre>
43
;Add a new menu item with the text "Whois", when clicked execute "/whois $1".
44
menu nicklist {
45
  Whois:/whois $1
46
}
47
</pre>
48 9 Per Amundsen
49 14 Per Amundsen
h2. Target multiple menus
50 1 Per Amundsen
51 11 Per Amundsen
Multiple menus can be targeted with the same menu item by separating them with comma.
52 8 Per Amundsen
53
*Example*
54
55
<pre>
56
;Add a new menu item for nicklist and channels with the text "Hello World", when clicked execute "/echo -ag Hello World".
57
menu nicklist,channel {
58 24 Per Amundsen
  Hello World:/echo -ag Hello World
59 8 Per Amundsen
}
60
</pre>
61
62 20 Per Amundsen
Wildcards can also be used.
63
64
*Example*
65
66
<pre>
67
; Add a new menu item for all menus with the text "Hello World", when clicked execute "/echo -ag Hello World".
68
menu * {
69 24 Per Amundsen
  Hello World:/echo -ag Hello World
70 20 Per Amundsen
}
71
72
; Add a new menu item for all custom window menus with the text "Hello World", when clicked execute "/echo -ag Hello World".
73
menu @* {
74 24 Per Amundsen
  Hello World:/echo -ag Hello World
75 20 Per Amundsen
}
76
</pre>
77
78 14 Per Amundsen
h2. Menu hierarchy
79 1 Per Amundsen
80
The menu hierarchy is determined by punctuation marks.
81
82 10 Per Amundsen
This works in both the Menu Editor and in a custom script using the Menu prefix.
83 1 Per Amundsen
84
*Example*
85
86
<pre>
87
menu nicklist {
88
  ;Create a upper menu item called "Tools", notice you don't need a colon for the upper menu.
89
  Tools
90
91 13 Per Amundsen
  ;Use a punctuation mark to put a sub menu item inside "Tools"
92 1 Per Amundsen
  .Whois:/whois $1
93
94 13 Per Amundsen
  ;Use a punctuation mark to put another sub menu item inside "Tools"
95 1 Per Amundsen
  .Who:/who $1
96
97
  ;Create another upper menu item called "Operate"
98
  Operate
99
100 13 Per Amundsen
  ;Use a punctuation mark to put a sub menu item inside "Operate"
101 1 Per Amundsen
  .Kill:kill $1
102
103
  ;Create a sub menu item called "Operate More" inside "Operate"
104
  .Operate More
105 13 Per Amundsen
106 1 Per Amundsen
  ;Use two punctuation marks to put a sub menu item inside "Operate More"
107
  ..Kill again:kill $1
108
}
109
</pre>
110 2 Per Amundsen
111 14 Per Amundsen
h2. Separator
112 6 Per Amundsen
113 7 Per Amundsen
Hyphen (-) can be used to add a menu separator.
114 6 Per Amundsen
115
*Example*
116
117
<pre>
118
menu nicklist {
119
  ;Create a upper menu item called "Tools"
120
  Tools
121
122
  ;Add a separator
123
  -
124
125
  ;Create another upper menu item called "More Tools"
126
  More Tools
127
}
128
</pre>
129
130
131 16 Per Amundsen
h2. $1- lines inside menus
132 2 Per Amundsen
133
$1- will be filled with different words depending on the menu type.
134
135
Status - The currently connected [[$network]] name.
136
Channel - The current [[$chan]] name.
137
Query - The [[$nick]] associated with the query window.
138
Nicklist - A list of selected nicks in the nicklist.
139 4 Per Amundsen
Menubar - Your nick ([[$me]]) on currently connected server.
140 17 Per Amundsen
141
h2. Adding top menus
142
143 18 Per Amundsen
As of AdiIRC 1.9.7 new top menus can be inserted in the Menubar after the "Help" item using the [[/menubar]] command.
144 17 Per Amundsen
145 19 Per Amundsen
Regular scripted menus can be used by referencing the @popup name, e.g "menu @mymenu { }"
146 25 Per Amundsen
147
h2. Mouse events
148
149
For [[/window|custom windows]] there are some special menu items which is triggered on various mouse events.
150
151 26 Per Amundsen
These menus must be at the start of the menu block.
152
153 25 Per Amundsen
Syntax is the same as regular menus, but the menu name must be of the following:
154
155 28 Per Amundsen
*Picture Windows*
156
157 25 Per Amundsen
mouse - Triggers when the mouse moves.
158
sclick - Triggers when the left mouse button is pressed down.
159
mclick - Triggers when the middle mouse button is pressed down. (AdiIRC only)
160
dclick - Triggers when the left mouse button is pressed down twice.
161 27 Per Amundsen
dmclick - Triggers when the middle mouse button is pressed down twice. (AdiIRC only)
162
drclick - Triggers when the right mouse button is pressed down twice. (AdiIRC only)
163 25 Per Amundsen
uclick - Triggers when any mouse button is released.
164
rclick - Triggers when the right mouse button is pressed down.
165
leave - Triggers when the mouse leaves the window.
166 1 Per Amundsen
drop - Triggers when the window receives a drag/drop event.
167 28 Per Amundsen
168
*Custom Windows text area*
169
170 29 Per Amundsen
rclick - Triggers when the right mouse button is pressed down.
171 28 Per Amundsen
dclick - Triggers when the left mouse button is pressed down twice.
172
dmclick - Triggers when the middle mouse button is pressed down twice. (AdiIRC only)
173
drclick - Triggers when the right mouse button is pressed down twice. (AdiIRC only)
174
175
*Custom Windows Nicklist*
176
177
lbclick - Triggers when the left mouse button is pressed down in the listbox.
178
rclick - Triggers when the right mouse button is pressed down.
179
dclick - Triggers when the left mouse button is pressed down twice.
180
dmclick - Triggers when the middle mouse button is pressed down twice. (AdiIRC only)
181
drclick - Triggers when the right mouse button is pressed down twice. (AdiIRC only)
182 26 Per Amundsen
183 30 Per Amundsen
rclick and drclick only triggers when there is no right click menu or the right click menu has no items.
184
185 26 Per Amundsen
*Example*
186
187
<pre>
188
; Create a custom window.
189
/window @test
190
191
; Add a mouse menu.
192
menu @test {
193
  slick:echo -ag Left mouse button was clicked.
194
  rlick:echo -ag Right mouse button was clicked.
195
  Menu:echo -ag Just a regular menu item.
196
}
197
</pre>