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