Project

General

Profile

Scripting Menus » History » Version 20

Per Amundsen, 10/22/2015 04:32 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
A menu syntax consists of Menu text<colon>Menu command.
14
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 14 Per Amundsen
h2. Menu prefix
25 9 Per Amundsen
26 12 Per Amundsen
The "menu" prefix can also be used in a custom script to add more items to a menu.
27 1 Per Amundsen
28
*Example*
29
30
<pre>
31
;Add a new menu item with the text "Whois", when clicked execute "/whois $1".
32
menu nicklist {
33
  Whois:/whois $1
34
}
35
</pre>
36 9 Per Amundsen
37 14 Per Amundsen
h2. Target multiple menus
38 1 Per Amundsen
39 11 Per Amundsen
Multiple menus can be targeted with the same menu item by separating them with comma.
40 8 Per Amundsen
41
*Example*
42
43
<pre>
44
;Add a new menu item for nicklist and channels with the text "Hello World", when clicked execute "/echo -ag Hello World".
45
menu nicklist,channel {
46 1 Per Amundsen
  Hello World/echo -ag Hello World
47 8 Per Amundsen
}
48
</pre>
49
50 20 Per Amundsen
Wildcards can also be used.
51
52
*Example*
53
54
<pre>
55
; Add a new menu item for all menus with the text "Hello World", when clicked execute "/echo -ag Hello World".
56
menu * {
57
  Hello World/echo -ag Hello World
58
}
59
60
; Add a new menu item for all custom window menus with the text "Hello World", when clicked execute "/echo -ag Hello World".
61
menu @* {
62
  Hello World/echo -ag Hello World
63
}
64
</pre>
65
66 14 Per Amundsen
h2. Menu hierarchy
67 1 Per Amundsen
68
The menu hierarchy is determined by punctuation marks.
69
70 10 Per Amundsen
This works in both the Menu Editor and in a custom script using the Menu prefix.
71 1 Per Amundsen
72
*Example*
73
74
<pre>
75
menu nicklist {
76
  ;Create a upper menu item called "Tools", notice you don't need a colon for the upper menu.
77
  Tools
78
79 13 Per Amundsen
  ;Use a punctuation mark to put a sub menu item inside "Tools"
80 1 Per Amundsen
  .Whois:/whois $1
81
82 13 Per Amundsen
  ;Use a punctuation mark to put another sub menu item inside "Tools"
83 1 Per Amundsen
  .Who:/who $1
84
85
  ;Create another upper menu item called "Operate"
86
  Operate
87
88 13 Per Amundsen
  ;Use a punctuation mark to put a sub menu item inside "Operate"
89 1 Per Amundsen
  .Kill:kill $1
90
91
  ;Create a sub menu item called "Operate More" inside "Operate"
92
  .Operate More
93 13 Per Amundsen
94 1 Per Amundsen
  ;Use two punctuation marks to put a sub menu item inside "Operate More"
95
  ..Kill again:kill $1
96
}
97
</pre>
98 2 Per Amundsen
99 14 Per Amundsen
h2. Separator
100 6 Per Amundsen
101 7 Per Amundsen
Hyphen (-) can be used to add a menu separator.
102 6 Per Amundsen
103
*Example*
104
105
<pre>
106
menu nicklist {
107
  ;Create a upper menu item called "Tools"
108
  Tools
109
110
  ;Add a separator
111
  -
112
113
  ;Create another upper menu item called "More Tools"
114
  More Tools
115
}
116
</pre>
117
118
119 16 Per Amundsen
h2. $1- lines inside menus
120 2 Per Amundsen
121
$1- will be filled with different words depending on the menu type.
122
123
Status - The currently connected [[$network]] name.
124
Channel - The current [[$chan]] name.
125
Query - The [[$nick]] associated with the query window.
126
Nicklist - A list of selected nicks in the nicklist.
127 4 Per Amundsen
Menubar - Your nick ([[$me]]) on currently connected server.
128 17 Per Amundsen
129
h2. Adding top menus
130
131 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.
132 17 Per Amundsen
133 19 Per Amundsen
Regular scripted menus can be used by referencing the @popup name, e.g "menu @mymenu { }"