Project

General

Profile

Scripting Menus » History » Version 32

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