Scripting Menus » History » Version 12
Per Amundsen, 03/29/2014 09:10 PM
1 | 1 | Per Amundsen | *Scripting Menus* |
---|---|---|---|
2 | |||
3 | 5 | Per Amundsen | You can edit most AdiIRC menus in the Menu Editor located at Tools -> Edit Menus. |
4 | 1 | Per Amundsen | |
5 | Status - Edit the status menus. |
||
6 | Channel - Edit the channel menus. |
||
7 | Query - Edit the query menus. |
||
8 | Nicklist - Edit the nicklist menus. |
||
9 | Menubar - Edit the menubar menus. |
||
10 | |||
11 | A menu syntax consists of Menu text<colon>Menu command. |
||
12 | |||
13 | 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. |
||
14 | |||
15 | *Example* |
||
16 | |||
17 | <pre> |
||
18 | ; 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. |
||
19 | Query:/query $1 |
||
20 | </pre> |
||
21 | |||
22 | 9 | Per Amundsen | *Menu prefix* |
23 | |||
24 | 12 | Per Amundsen | The "menu" prefix can also be used in a custom script to add more items to a menu. |
25 | 1 | Per Amundsen | |
26 | *Example* |
||
27 | |||
28 | <pre> |
||
29 | ;Add a new menu item with the text "Whois", when clicked execute "/whois $1". |
||
30 | menu nicklist { |
||
31 | Whois:/whois $1 |
||
32 | } |
||
33 | </pre> |
||
34 | 9 | Per Amundsen | |
35 | *Target multiple menus* |
||
36 | 1 | Per Amundsen | |
37 | 11 | Per Amundsen | Multiple menus can be targeted with the same menu item by separating them with comma. |
38 | 8 | Per Amundsen | |
39 | *Example* |
||
40 | |||
41 | <pre> |
||
42 | ;Add a new menu item for nicklist and channels with the text "Hello World", when clicked execute "/echo -ag Hello World". |
||
43 | menu nicklist,channel { |
||
44 | Hello World/echo -ag Hello World |
||
45 | } |
||
46 | </pre> |
||
47 | |||
48 | 1 | Per Amundsen | *Menu hierarchy* |
49 | |||
50 | The menu hierarchy is determined by punctuation marks. |
||
51 | |||
52 | 10 | Per Amundsen | This works in both the Menu Editor and in a custom script using the Menu prefix. |
53 | 1 | Per Amundsen | |
54 | *Example* |
||
55 | |||
56 | <pre> |
||
57 | menu nicklist { |
||
58 | ;Create a upper menu item called "Tools", notice you don't need a colon for the upper menu. |
||
59 | Tools |
||
60 | |||
61 | ;Use a punctuation mark to put a menu item inside "Tools" |
||
62 | .Whois:/whois $1 |
||
63 | |||
64 | ;Use a punctuation mark to put another menu item inside "Tools" |
||
65 | .Who:/who $1 |
||
66 | |||
67 | ;Create another upper menu item called "Operate" |
||
68 | Operate |
||
69 | |||
70 | ;Use a punctuation mark to put a menu item inside "Operate" |
||
71 | .Kill:kill $1 |
||
72 | |||
73 | ;Create a sub menu item called "Operate More" inside "Operate" |
||
74 | .Operate More |
||
75 | |||
76 | ;Use two punctuation mark to put a menu item inside "Operate More" |
||
77 | ..Kill again:kill $1 |
||
78 | } |
||
79 | </pre> |
||
80 | 2 | Per Amundsen | |
81 | 6 | Per Amundsen | *Separator* |
82 | |||
83 | 7 | Per Amundsen | Hyphen (-) can be used to add a menu separator. |
84 | 6 | Per Amundsen | |
85 | *Example* |
||
86 | |||
87 | <pre> |
||
88 | menu nicklist { |
||
89 | ;Create a upper menu item called "Tools" |
||
90 | Tools |
||
91 | |||
92 | ;Add a separator |
||
93 | - |
||
94 | |||
95 | ;Create another upper menu item called "More Tools" |
||
96 | More Tools |
||
97 | } |
||
98 | </pre> |
||
99 | |||
100 | |||
101 | 2 | Per Amundsen | *$1- lines inside menus* |
102 | |||
103 | $1- will be filled with different words depending on the menu type. |
||
104 | |||
105 | Status - The currently connected [[$network]] name. |
||
106 | Channel - The current [[$chan]] name. |
||
107 | Query - The [[$nick]] associated with the query window. |
||
108 | Nicklist - A list of selected nicks in the nicklist. |
||
109 | 4 | Per Amundsen | Menubar - Your nick ([[$me]]) on currently connected server. |