Programmatic button click

更新时间:
复制 MD 格式

This topic demonstrates how to use the Execute() method to programmatically click the more menu on demand.

  • Demonstration

    • Before the click: The target button is the more menu (represented by a three-line icon) in the top-left corner of the web editor's toolbar.

    • After the click: The button expands a drop-down menu that contains seven options: export as PDF, export as image, save version, version history, collaboration history, rename, and print.

  • Syntax

    expression.CommandBars(CommandBarId).Execute()

    The expression is the application object.

  • Example

    async function example() {
      await instance.ready();
      const app = instance.Application;
      // Get the CommandBars object for the more menu.
      const moreMenus = await app.CommandBars('MoreMenus');
      // Trigger the event after 3000 ms.
      setTimeout( async () => {
        // Click the more menu.
        await moreMenus.Execute();
      }, 3000);
    }