# How do I add a button to the editor (with a custom script)?

**URL:** <https://forum.xwiki.org/t/how-do-i-add-a-button-to-the-editor-with-a-custom-script/9253>\
**Category:** Help / Discuss\
**Tags:** ckeditor\
**Created:** [September 30, 2021, 1:01pm UTC](https://forum.xwiki.org/t/how-do-i-add-a-button-to-the-editor-with-a-custom-script/9253 "2021-09-30T13:01:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dahin](https://forum.xwiki.org/letter_avatar_proxy/v4/letter/d/779978/32.png) [@dahin](https://forum.xwiki.org/u/dahin)\
**Post date:** [September 30, 2021, 1:01pm UTC](https://forum.xwiki.org/t/how-do-i-add-a-button-to-the-editor-with-a-custom-script/9253/1 "2021-09-30T13:01:06Z")

</div>

Hey dear XWiki-Community,

I have written a velocity-script I want my users to be able to use. However, I dont want them to copy my script to the source editor, but to use a button in the optical editor.  
The editor page I have read and I have already been able to add a button to the toolbar which inserts a macro.  
But as described above, I want to add a button which opens a dialogue in which the user can put a text. The text then should be put in the middle of my script and all of it inserted into the page which is being edited.  
How can I achieve that? Do I have to write a macro in java?

BR  
dahin
