tc_window
Control the active 1C:Enterprise client window: activate or close it, run commands, answer Yes/No dialogs, and read user messages or the command interface.
Instructions
Actions on the client application window. In the signatures below a trailing * marks a REQUIRED parameter — the group schema itself accepts every parameter as optional. Actions:
activate_window() Activate the current active window. (1C 8.3.3+)
answer_dialog(confirm=True, timeout=5) Answer a modal Yes/No question raised by the configuration. The question is an ordinary window and its buttons are picked by NAME: Button0 answers yes, Button1 answers no. A dialog may offer a THIRD choice (Button2 is often 'Отмена') which this action never presses — read
questionand inspect the window with tc_find(action="find_objects") when the answer you need is a different button. Waits up to timeout seconds for such a dialog to appear. Returns answered='Да'/'Нет' andquestion, or both null when no dialog showed up;questionalone is null when the dialog carried no readable message. (1C 8.3.3+)close_user_messages_panel() Close the window's user-messages panel. This is also how you tell which messages belong to which action: clear the panel, perform the action, then read the messages. (1C 8.3.6+)
close_window() Close the current active window. ok only says the close was accepted: the configuration may answer with a modal question ('Send the invitations?', 'Save the changes?') and leave the window open. Check with get_active_window afterwards. Also closes an active local print preview identified by get_active_window, returning to the underlying form. If the active window cannot be identified and local recovery is unavailable, returns code=active_window_unavailable without closing another window. (1C 8.3.3+)
execute_command(command*) Run a window command by name, or open an object by a navigation link. Both forms are accepted: a command-interface command name, and a link such as 'e1cib/list/Справочник.Контрагенты' (list), 'e1cib/app/Обработка.Имя' or 'e1cib/command/...'. The navigation link is usually how a scenario starts, since it opens a list or form without hunting through the command interface first. (1C 8.3.3+)
get_command_interface() Get the window's command interface → collection of buttons/groups. (1C 8.3.3+)
get_user_message_texts() Get the user-message texts shown in the window → list of strings. These ACCUMULATE over the session: a complaint from an earlier attempt is still listed after a later attempt succeeded. To judge one action, call tc_window(action="close_user_messages_panel") first, then the action, then this. (1C 8.3.3+)
goto_next_window() Ask for the next application window. The command is accepted, but no measurement has shown it switching anything: the platform runs it on the MAIN application window only, and that window is not addressable here. To go to another window, activate its form — tc_field(action="activate") on that window's ManagedForm ref, measured to work both ways. (1C 8.3.6+)
goto_previous_window() Ask for the previous application window. The command is accepted, but no measurement has shown it switching anything: the platform runs it on the MAIN application window only, and that window is not addressable here. To go to another window, activate its form — tc_field(action="activate") on that window's ManagedForm ref, measured to work both ways. (1C 8.3.6+)
goto_start_page() Ask for the start page. The command is accepted, but no measurement has shown it switching anything: the platform runs it on the MAIN application window only, and that window is not addressable here. To go to another window, activate its form — tc_field(action="activate") on that window's ManagedForm ref, measured to work both ways. (1C 8.3.6+) connection_id selects the client. With several clients, connection_id is required. Use tc_session(action="list_connections"). Returned references can be passed unchanged to actions that accept them. If a reference expires, find the element again.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| action | Yes | ||
| command | No | ||
| confirm | No | ||
| timeout | No | ||
| connection_id | No |