Scripting Menus » History » Version 14
Per Amundsen, 02/11/2015 12:55 AM
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 | 14 | Per Amundsen | h2. Menu hierarchy |
51 | 1 | Per Amundsen | |
52 | The menu hierarchy is determined by punctuation marks. |
||
53 | |||
54 | 10 | Per Amundsen | This works in both the Menu Editor and in a custom script using the Menu prefix. |
55 | 1 | Per Amundsen | |
56 | *Example* |
||
57 | |||
58 | <pre> |
||
59 | menu nicklist { |
||
60 | ;Create a upper menu item called "Tools", notice you don't need a colon for the upper menu. |
||
61 | Tools |
||
62 | |||
63 | 13 | Per Amundsen | ;Use a punctuation mark to put a sub menu item inside "Tools" |
64 | 1 | Per Amundsen | .Whois:/whois $1 |
65 | |||
66 | 13 | Per Amundsen | ;Use a punctuation mark to put another sub menu item inside "Tools" |
67 | 1 | Per Amundsen | .Who:/who $1 |
68 | |||
69 | ;Create another upper menu item called "Operate" |
||
70 | Operate |
||
71 | |||
72 | 13 | Per Amundsen | ;Use a punctuation mark to put a sub menu item inside "Operate" |
73 | 1 | Per Amundsen | .Kill:kill $1 |
74 | |||
75 | ;Create a sub menu item called "Operate More" inside "Operate" |
||
76 | .Operate More |
||
77 | 13 | Per Amundsen | |
78 | 1 | Per Amundsen | ;Use two punctuation marks to put a sub menu item inside "Operate More" |
79 | ..Kill again:kill $1 |
||
80 | } |
||
81 | </pre> |
||
82 | 2 | Per Amundsen | |
83 | 14 | Per Amundsen | h2. Separator |
84 | 6 | Per Amundsen | |
85 | 7 | Per Amundsen | Hyphen (-) can be used to add a menu separator. |
86 | 6 | Per Amundsen | |
87 | *Example* |
||
88 | |||
89 | <pre> |
||
90 | menu nicklist { |
||
91 | ;Create a upper menu item called "Tools" |
||
92 | Tools |
||
93 | |||
94 | ;Add a separator |
||
95 | - |
||
96 | |||
97 | ;Create another upper menu item called "More Tools" |
||
98 | More Tools |
||
99 | } |
||
100 | </pre> |
||
101 | |||
102 | |||
103 | 2 | Per Amundsen | *$1- lines inside menus* |
104 | |||
105 | $1- will be filled with different words depending on the menu type. |
||
106 | |||
107 | Status - The currently connected [[$network]] name. |
||
108 | Channel - The current [[$chan]] name. |
||
109 | Query - The [[$nick]] associated with the query window. |
||
110 | Nicklist - A list of selected nicks in the nicklist. |
||
111 | 4 | Per Amundsen | Menubar - Your nick ([[$me]]) on currently connected server. |