# Send UNO command using postMessage

**URL:** <https://forum.collaboraonline.com/t/send-uno-command-using-postmessage/1711>\
**Category:** Development\
**Created:** [March 24, 2023, 8:47pm UTC](https://forum.collaboraonline.com/t/send-uno-command-using-postmessage/1711 "2023-03-24T20:47:41Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![pmzi](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.collaboraonline.com/pmzi/32/677_2.png) [@pmzi](https://forum.collaboraonline.com/u/pmzi)\
**Post date:** [March 24, 2023, 8:47pm UTC](https://forum.collaboraonline.com/t/send-uno-command-using-postmessage/1711/1 "2023-03-24T20:47:41Z")

</div>

Hi there,

Is there any way to send a UNO command as a `postMessage` to the CODE iframe directly? I want to send a UNO command with arguments to the iframe and therefore, it is sent to the WSD server from there. Is it possible now? And if not, how can I execute UNO commands from the wrapper of the iframe?

Thanks

---

<div class="post-metadata">

**Author:** ![mmeeks](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.collaboraonline.com/mmeeks/32/371_2.png) [@mmeeks](https://forum.collaboraonline.com/u/mmeeks)\
**Post date:** [March 25, 2023, 2:59pm UTC](https://forum.collaboraonline.com/t/send-uno-command-using-postmessage/1711/2 "2023-03-25T14:59:16Z")

</div>

You can do this via python scripts if you like using a PostMessage:

[https://sdk.collaboraonline.com/docs/postmessage\_api.html#calling-python-scripts](https://sdk.collaboraonline.com/docs/postmessage_api.html#calling-python-scripts)

You can do an Insert\_Button with a specific UNO command (though we tend to filter these to ones that we support / make sense):

[https://sdk.collaboraonline.com/docs/postmessage\_api.html#id5](https://sdk.collaboraonline.com/docs/postmessage_api.html#id5)

Quite probably we should add a new post-message to invoke a UNO command - like the Python thing, but simpler; what command do you want to invoke ? =)

---

<div class="post-metadata">

**Author:** ![pmzi](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.collaboraonline.com/pmzi/32/677_2.png) [@pmzi](https://forum.collaboraonline.com/u/pmzi)\
**Post date:** [March 25, 2023, 4:04pm UTC](https://forum.collaboraonline.com/t/send-uno-command-using-postmessage/1711/3 "2023-03-25T16:04:48Z")

</div>

I don’t really want to use Python macros. I wanted to use postMessages to directly execute UNO commands through `sendUnoCommand` method (with arguments), that’s why the UNO command inside button property is not going to answer my need.

I will contribute and add the postMessage to run any UNO command directly using postMessages, since it is easy to add, and in that way, I will contribute to the CODE to kind of give back to the community as well:)

I wanted to use `uno:InsertBookmark` UNO command to add bookmarks using postMessages.

Thanks for your response.

---

<div class="post-metadata">

**Author:** ![pedro.silva](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.collaboraonline.com/pedro.silva/32/4_2.png) [@pedro.silva](https://forum.collaboraonline.com/u/pedro.silva)\
**Post date:** [March 30, 2023, 10:40am UTC](https://forum.collaboraonline.com/t/send-uno-command-using-postmessage/1711/4 "2023-03-30T10:40:13Z")

</div>

Thanks @pmzi for the PR [Feature add Send\_UNO\_Command postMessage by pmzi · Pull Request #6099 · CollaboraOnline/online · GitHub](https://github.com/CollaboraOnline/online/pull/6099)

---

<div class="post-metadata">

**Author:** ![pedro.silva](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.collaboraonline.com/pedro.silva/32/4_2.png) [@pedro.silva](https://forum.collaboraonline.com/u/pedro.silva)\
**Post date:** [April 6, 2023, 7:39am UTC](https://forum.collaboraonline.com/t/send-uno-command-using-postmessage/1711/5 "2023-04-06T07:39:28Z")

</div>

SDK documentation updated: [Search — SDK https://sdk.collaboraonline.com/ documentation](https://sdk.collaboraonline.com/search.html?q=Send_UNO_Command&check_keywords=yes&area=default)
