AutoMenu
Sets up a reusable menu trap. Works the same as WaitMenu, but the hook is persistent — it triggers every time a matching menu appears, until explicitly removed via CancelMenu.
When an incoming menu’s caption contains MenuCaption and the menu has an element containing ElementCaption, that element is automatically selected.
Both parameters accept the same special values as in WaitMenu: (any) as MenuCaption matches any menu title, and (first), (second), (last), (random), (any), (cancel) or (N) as ElementCaption pick an element without matching its text. An empty parameter is not a wildcard — the call is ignored and a note is written to the system journal.
To set a one-time trap, use WaitMenu instead. To remove all menu hooks, use CancelMenu.
Устанавливает многоразовую ловушку на меню. Работает так же, как WaitMenu, но хук постоянный — он срабатывает каждый раз при появлении подходящего меню, пока не будет явно удалён через CancelMenu.
Когда заголовок входящего меню содержит MenuCaption, а в меню есть элемент, содержащий ElementCaption, этот элемент выбирается автоматически.
Оба параметра принимают те же специальные значения, что и в WaitMenu: (any) в MenuCaption совпадает с любым заголовком меню, а (first), (second), (last), (random), (any), (cancel) или (N) в ElementCaption выбирают пункт без сопоставления его текста. Пустой параметр не является wildcard — вызов игнорируется, в системный журнал пишется соответствующая запись.
Для одноразовой ловушки используйте WaitMenu. Для удаления всех хуков используйте CancelMenu.
procedure AutoMenu(MenuCaption: String; ElementCaption: String);
Parameters:
- MenuCaption — substring to match against the menu title, or
(any). - ElementCaption — substring to match against a menu element to auto-select, or one of the bracketed commands listed in WaitMenu.
def AutoMenu(MenuCaption: str, ElementCaption: str) -> None: ...
begin
CancelMenu; // clear any existing hooks
AutoMenu('Tracking', 'Animals');
UseSkill('Tracking');
end.
CancelMenu()
AutoMenu('Tracking', 'Animals')
UseSkill('Tracking')