update_os_event()

Updates the script code — and optionally the scripting language — of an existing OsEvent via dms.UpdateOsEvent.

The script code (vb_code) and, with is_js, the scripting language can be changed. The event code, target object type, context parameter, and platform are immutable. To change any of those, delete the event with delete_os_event() and recreate it with create_os_event() — which yields a new id.

1. Signature

  • Sync

  • Async

ecm.system.update_os_event(
    os_event_id: int,
    script: str,
    *,
    is_js: bool | None = None,
) -> None
await ecm.system.update_os_event(
    os_event_id: int,
    script: str,
    *,
    is_js: bool | None = None,
) -> None

2. Parameters

Parameter Type Default Description

os_event_id

int

—

Id of the event to update (the id field of an ECMOsEvent).

script

str

—

The new script code (JavaScript or VBScript). Sent to the server as UTF-8 with a leading byte-order mark (BOM); the server detects the BOM and stores the full Unicode range.

is_js

bool | None

None

Switches the scripting language: True = JavaScript, False = VBScript. Omitted, the event keeps the language it has — which is what keeps an existing call site unaffected.

3. Return value

None (None). A server error raises an exception.

4. Examples

  • Sync

  • Async

ecm.system.update_os_event(9, "'updated script")

# switch the event to JavaScript
ecm.system.update_os_event(9, "// updated script", is_js=True)
await ecm.system.update_os_event(9, "'updated script")

# switch the event to JavaScript
await ecm.system.update_os_event(9, "// updated script", is_js=True)

5. See also