Hi, I am trying to create a button that copies a text to the clipboard from the dashboard but I can't do it in any way or with any node, could someone who has done something similar help me? Thank you
You could probably use a bash script to copy to clipboard if you are using linux/mac , and then execute that bash script via node-red exec node...
im using node-red in windows
Well i think this answer will help you , just make sure to format the command string properly with the value you want to copy, and then execute the command via exec node
but this only works with one permanent text no?, i want to take variable text from dashboard and copy it to my clipboard by clicking a button of dashboard.
You can do this using the dashboard template node.
- Copy paste W3Schools Tryit Editor in the template node.
- Then you can further modify the html/javascript of the template node to your needs.
- I would send the dynamic text to copy to the clipboard as msg.payload to the template node.
- In template node code you can refer to the payload by
{{msg.payload}}
This is even better solution than mine
If you implement msg.payload instead of the abc, it would work. But janvda method is 100% better than mine, and it will copy on any device, my script will only copy on server side.
This is down to your browser and OS, not Node-RED.
Allowing the browser to control access to the clipboard is fraught with security issues which is why it isn't necessarily easy.
Please share what browser you want to target.
Thank you, it works as I wanted.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.