Project

General

Profile

Scripting Menus » History » Version 39

Per Amundsen, 09/28/2018 10:36 AM

1 14 Per Amundsen
{{>toc}}
2 1 Per Amundsen
3 14 Per Amundsen
h1. Scripting Menus
4
5 36 Per Amundsen
You can edit most AdiIRC menus in the Menu Editor located at Menubar -> 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 32 Per Amundsen
ChannelLink - Edit the channel link menus. (AdiIRC only)
13
Link - Edit the regular link menus. (AdiIRC only)
14 1 Per Amundsen
15 21 Per Amundsen
A menu syntax consists of <Menu text><colon><Menu command>.
16 1 Per Amundsen
17
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.
18
19 38 Per Amundsen
_[[$chr|$chr(58)]] can be used to add a colon in most cases._
20
21 1 Per Amundsen
*Example*
22
23
<pre>
24
; 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.
25
Query:/query $1
26
</pre>
27
28 37 Per Amundsen
Menu commands can also contain multiple lines, if so they must be enclosed with curly brackets.
29 22 Per Amundsen
30
*Example*
31
32
<pre>
33
; Add a new menu item with the text "Query", when clicked, execute both "/query $1" and "/whois $1".
34
Query:{
35
  /query $1
36
  /whois $1
37
}
38
</pre>
39
40 14 Per Amundsen
h2. Menu prefix
41 9 Per Amundsen
42 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.
43 1 Per Amundsen
44
*Example*
45
46
<pre>
47
;Add a new menu item with the text "Whois", when clicked execute "/whois $1".
48
menu nicklist {
49
  Whois:/whois $1
50
}
51
</pre>
52 9 Per Amundsen
53 14 Per Amundsen
h2. Target multiple menus
54 1 Per Amundsen
55 11 Per Amundsen
Multiple menus can be targeted with the same menu item by separating them with comma.
56 8 Per Amundsen
57
*Example*
58
59
<pre>
60
;Add a new menu item for nicklist and channels with the text "Hello World", when clicked execute "/echo -ag Hello World".
61
menu nicklist,channel {
62 24 Per Amundsen
  Hello World:/echo -ag Hello World
63 8 Per Amundsen
}
64
</pre>
65
66 35 Per Amundsen
[[Scripting_Wildcards|Wildcards]] can also be used.
67 20 Per Amundsen
68
*Example*
69
70
<pre>
71
; Add a new menu item for all menus with the text "Hello World", when clicked execute "/echo -ag Hello World".
72
menu * {
73 24 Per Amundsen
  Hello World:/echo -ag Hello World
74 20 Per Amundsen
}
75
76
; Add a new menu item for all custom window menus with the text "Hello World", when clicked execute "/echo -ag Hello World".
77
menu @* {
78 24 Per Amundsen
  Hello World:/echo -ag Hello World
79 20 Per Amundsen
}
80
</pre>
81
82 14 Per Amundsen
h2. Menu hierarchy
83 1 Per Amundsen
84
The menu hierarchy is determined by punctuation marks.
85
86 10 Per Amundsen
This works in both the Menu Editor and in a custom script using the Menu prefix.
87 1 Per Amundsen
88
*Example*
89
90
<pre>
91
menu nicklist {
92
  ;Create a upper menu item called "Tools", notice you don't need a colon for the upper menu.
93
  Tools
94
95 13 Per Amundsen
  ;Use a punctuation mark to put a sub menu item inside "Tools"
96 1 Per Amundsen
  .Whois:/whois $1
97
98 13 Per Amundsen
  ;Use a punctuation mark to put another sub menu item inside "Tools"
99 1 Per Amundsen
  .Who:/who $1
100
101
  ;Create another upper menu item called "Operate"
102
  Operate
103
104 13 Per Amundsen
  ;Use a punctuation mark to put a sub menu item inside "Operate"
105 1 Per Amundsen
  .Kill:kill $1
106
107
  ;Create a sub menu item called "Operate More" inside "Operate"
108
  .Operate More
109 13 Per Amundsen
110 1 Per Amundsen
  ;Use two punctuation marks to put a sub menu item inside "Operate More"
111
  ..Kill again:kill $1
112
}
113
</pre>
114 2 Per Amundsen
115 14 Per Amundsen
h2. Separator
116 6 Per Amundsen
117 7 Per Amundsen
Hyphen (-) can be used to add a menu separator.
118 6 Per Amundsen
119
*Example*
120
121
<pre>
122
menu nicklist {
123
  ;Create a upper menu item called "Tools"
124
  Tools
125
126
  ;Add a separator
127
  -
128
129
  ;Create another upper menu item called "More Tools"
130
  More Tools
131
}
132
</pre>
133
134 31 Per Amundsen
h2. Merging menu items
135
136
It's possible to merge menu items with other menu items using the same text.
137
138
*Example*
139
140
<pre>
141
; Both "Apple" and "Banana" will be shown in the "Fruit" menu.
142
menu * {
143
  Fruit
144
  .Banana
145
}
146
147
menu * {
148
  Fruit
149
  .Apple
150
}
151
</pre>
152 6 Per Amundsen
153 16 Per Amundsen
h2. $1- lines inside menus
154 2 Per Amundsen
155
$1- will be filled with different words depending on the menu type.
156
157
Status - The currently connected [[$network]] name.
158
Channel - The current [[$chan]] name.
159
Query - The [[$nick]] associated with the query window.
160
Nicklist - A list of selected nicks in the nicklist.
161 4 Per Amundsen
Menubar - Your nick ([[$me]]) on currently connected server.
162 17 Per Amundsen
163
h2. Adding top menus
164
165 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.
166 17 Per Amundsen
167 19 Per Amundsen
Regular scripted menus can be used by referencing the @popup name, e.g "menu @mymenu { }"
168 25 Per Amundsen
169
h2. Mouse events
170
171
For [[/window|custom windows]] there are some special menu items which is triggered on various mouse events.
172
173 26 Per Amundsen
These menus must be at the start of the menu block.
174
175 25 Per Amundsen
Syntax is the same as regular menus, but the menu name must be of the following:
176
177 28 Per Amundsen
*Picture Windows*
178
179 25 Per Amundsen
mouse - Triggers when the mouse moves.
180
sclick - Triggers when the left mouse button is pressed down.
181
mclick - Triggers when the middle mouse button is pressed down. (AdiIRC only)
182
dclick - Triggers when the left mouse button is pressed down twice.
183 27 Per Amundsen
dmclick - Triggers when the middle mouse button is pressed down twice. (AdiIRC only)
184
drclick - Triggers when the right mouse button is pressed down twice. (AdiIRC only)
185 25 Per Amundsen
uclick - Triggers when any mouse button is released.
186
rclick - Triggers when the right mouse button is pressed down.
187
leave - Triggers when the mouse leaves the window.
188 1 Per Amundsen
drop - Triggers when the window receives a drag/drop event.
189 28 Per Amundsen
190
*Custom Windows text area*
191
192 29 Per Amundsen
rclick - Triggers when the right mouse button is pressed down.
193 28 Per Amundsen
dclick - Triggers when the left mouse button is pressed down twice.
194
dmclick - Triggers when the middle mouse button is pressed down twice. (AdiIRC only)
195
drclick - Triggers when the right mouse button is pressed down twice. (AdiIRC only)
196
197
*Custom Windows Nicklist*
198
199
lbclick - Triggers when the left mouse button is pressed down in the listbox.
200
rclick - Triggers when the right mouse button is pressed down.
201
dclick - Triggers when the left mouse button is pressed down twice.
202
dmclick - Triggers when the middle mouse button is pressed down twice. (AdiIRC only)
203
drclick - Triggers when the right mouse button is pressed down twice. (AdiIRC only)
204 26 Per Amundsen
205 30 Per Amundsen
rclick and drclick only triggers when there is no right click menu or the right click menu has no items.
206
207 26 Per Amundsen
*Example*
208
209
<pre>
210
; Create a custom window.
211
/window @test
212
213
; Add a mouse menu.
214
menu @test {
215
  slick:echo -ag Left mouse button was clicked.
216
  rlick:echo -ag Right mouse button was clicked.
217
  Menu:echo -ag Just a regular menu item.
218
}
219
</pre>
220 33 Per Amundsen
221
h2. Menu styles
222
223
You can style menus with check mark and disable them using the [[$style]] identifier.
224
225
*Checked*
226
227
!checked.png!
228
<pre>
229
menu * {
230
  Checked $style(1):noop
231
}
232
</pre>
233
234
*Disabled*
235
236
!disabled.png!
237
<pre>
238
menu * {
239
  Disabled $style(2):noop
240
}
241
</pre>
242
243 1 Per Amundsen
*Checked and disabled*
244 34 Per Amundsen
245
!checked_and_disabled.png!
246 33 Per Amundsen
<pre>
247
menu * {
248
  Checked and disabled $style(3):noop
249
}
250
</pre>
251
252
h2. Menu icons
253
254
In AdiIRC it's also possible to add a icon to any menu item using the [[$menuicon]] identifier.
255
256
!icon.png!
257
<pre>
258
menu * {
259
  Icon $menuicon($scriptdir\icon.ico):noop
260
}
261
</pre>
262 39 Per Amundsen
263
h2. Dynamic sub menus
264
265
To dynamically create sub menus, the [[$submenu]] identifier can be used.
266
267
*Example*
268
269
<pre>
270
menu * {
271
 Animal
272
 .$submenu($animal($1))
273
}
274
275
alias animal {
276
 if ($1 == begin) return -
277
 if ($1 == 1) return Dog:echo Dog
278
 if ($1 == 2) return Cat:echo Cat
279
 if ($1 == 3) return Bird:echo Bird
280
 if ($1 == end) return -
281
}
282
</pre>