How to get the selected elements in ppt

How to get the selected element in ppt ?

Hello, please describe the use-case scenario in more detail.
Also, do you want to get the element in the plugin or using Document Builder?

Hello,In PPT document ,there are several elements( Paragraph or ApiRun),user select one elements ,I want to get the text of the selected element and generate new text using AI, Can a elements have an ID or NAME set ?Can I get the selected element? Thank You.

You can try this scenario:

    Asc.scope.text = text; // export variable to plugin scope
    connector.callCommand(function() {
    var oDocument = Api.GetDocument();
    oDocument.SearchAndReplace({"searchString": Asc.scope.text, "replaceString": "replaced"});

Getselectedtext method gets the selected text, then in the method callback we pass a function in which we

  1. Pass the result of executing the getselectedtext method in the scope object
  2. Execute the required builder script, into which this scope can be passed