tc_app
Inspect and control 1C application state: read active windows, child UI objects, session errors, performance counters, and file-dialog results; set action time limits for test client automation.
Instructions
Application-level state: active window, child objects, errors, dialogs, limits. Common operations for objects of this type live elsewhere: tc_field(action="is_visible"), tc_field(action="is_enabled"), tc_field(action="get_context_menu"). In the signatures below a trailing * marks a REQUIRED parameter — the group schema itself accepts every parameter as optional. Actions:
clear_file_dialog_result() Clear a previously set file-dialog result. (1C 8.3.25+)
get_active_window() Return the application's active window: {ref, class, title, platform_version} and sometimes form_name. title is the caption of the window's managed form — null only when the window has no form or the caption could not be read. form_name is the form's name in the configuration metadata ('Справочник.Контрагенты.Форма.ФормаСписка'), unrelated to name, which for a form is a GUID. form_name is read only when the window itself gave no caption and may be absent even then: its absence says nothing about the form. To read it explicitly call tc_app(action="get_child_objects") on the window ref. platform_version is the version of this connection; actions unavailable on it are refused with available_since. addressable=false means the window has no element address; this alone does not identify its type. When local recovery is unavailable, code=active_window_unavailable explains how to continue. A local print preview may report native=true and recovery="close_window": close it to return to the form before addressing form elements. (1C 8.3.3+)
get_child_objects(ref=null) List one level of child UI objects under the addressed parent. If its address is omitted, use the last observed active window, querying the client if no window has been observed. For a whole subtree in one call use tc_find(action="find_objects"). Returns an object with parent and children: [...]. Child metadata includes class and title; name and type may also be present. type names a recognized platform element kind (e.g. CheckBoxField or Pages), and may be null when no kind is known for that object. A ManagedForm row can also carry form_name, its name in configuration metadata (e.g. 'Справочник.Контрагенты.Форма.ФормаСписка'), useful when the title is empty. Always obtain object addresses from tool results. Address the parent with ref; children contain ref values. For a whole subtree, pass root_ref to tc_find(action="find_objects"). (1C 8.3.3+)
get_current_error() Get info about the session's last CLIENT error (none → null). error is the main description; details preserves additional text, including nested causes, module locations and stacks. This is not where an application refusal shows up: messages raised by the configuration ("field not filled in", "posting is not possible") arrive in tc_window(action="get_user_message_texts"). Read that one with care — it returns the ACCUMULATED messages of the session, so an old complaint is still there after a later action succeeded; clear it with tc_window(action="close_user_messages_panel") before the action you want to judge. (1C 8.3.3+)
get_max_action_time() Get the max action-execution time in seconds (set via tc_app(action="set_max_action_time"); None if unset).
get_parent(ref*) Get an element's parent in parent: [...]. The server resolves the parent's own address and returns it with the available object metadata. Address the element with ref; objects in parent contain their own ref values. (1C 8.3.24+)
get_performance(clear=False) Get accumulated session performance counters (calls, duration, sent, received). Set clear to also reset them, so the next read measures only what happened after this call. (1C 8.3.6+)
set_file_dialog_result(result=True, filename=null, filter_index=0) Predefine the next file dialog's result: result=True + filename to simulate picking a file, result=False to cancel. Pass a list of names to simulate a multi-file selection. filter_index selects which dialog filter is active (0-based). Replaces any previous pending answer. The next file dialog consumes it; clear_file_dialog_result cancels an unused answer. (1C 8.3.8+)
set_max_action_time(seconds*) Set the max action-execution time in seconds: how long a result-returning action may take before the call gives up (0 = wait indefinitely). Stored on the client (no network call) and applied to every subsequent command. connection_id selects the client. Passing ref selects the client automatically; otherwise, with several clients, connection_id is required. Use tc_session(action="list_connections"). Pass reference values returned by the tools unchanged in ref. If a reference expires, find the element again.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ref | No | ||
| clear | No | ||
| action | Yes | ||
| result | No | ||
| seconds | No | ||
| filename | No | ||
| filter_index | No | ||
| connection_id | No |