# Accessing clipboard in Perspective

**URL:** <https://forum.inductiveautomation.com/t/accessing-clipboard-in-perspective/100741>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [January 10, 2025, 12:39am UTC](https://forum.inductiveautomation.com/t/accessing-clipboard-in-perspective/100741 "2025-01-10T00:39:53Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![bmusson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bmusson/32/87530_2.png) [@bmusson](https://forum.inductiveautomation.com/u/bmusson)\
**Post date:** [January 10, 2025, 2:40am UTC](https://forum.inductiveautomation.com/t/accessing-clipboard-in-perspective/100741/6 "2025-01-10T02:40:28Z")

</div>

Exactly.

Here's a simple example, reading the clipboard as text.

```python
# Get Clipboard Button
def runAction(self, event):
	
	def withClipboard(clipboard):
		self.view.custom.clipboard = clipboard
		
	
	system.perspective.runJavaScriptAsync('''async () => {
		return await navigator.clipboard.readText()
	}''', {}, withClipboard)

```

> **View JSON**
>
> ```json
> {
> "custom": {
> "clipboard": ""
> },
> "params": {},
> "propConfig": {
> "custom.clipboard": {
> "persistent": true
> }
> },
> "props": {},
> "root": {
> "children": [
> {
> "events": {
> "dom": {
> "onClick": {
> "config": {
> "script": "\t\n\tdef withClipboard(clipboard):\n\t\tself.view.custom.clipboard \u003d clipboard\n\t\t\n\t\n\tsystem.perspective.runJavaScriptAsync(\u0027\u0027\u0027async () \u003d\u003e {\n\t\treturn await navigator.clipboard.readText()\n\t}\u0027\u0027\u0027, {}, withClipboard)"
> },
> "scope": "G",
> "type": "script"
> }
> }
> },
> "meta": {
> "name": "Button"
> },
> "position": {
> "height": 34,
> "width": 193,
> "x": 499,
> "y": 167
> },
> "props": {
> "text": "Get Clipboard"
> },
> "type": "ia.input.button"
> },
> {
> "children": [
> {
> "meta": {
> "name": "Label"
> },
> "props": {
> "text": "Clipboard Contents"
> },
> "type": "ia.display.label"
> },
> {
> "meta": {
> "name": "Markdown"
> },
> "position": {
> "grow": 1
> },
> "propConfig": {
> "props.source": {
> "binding": {
> "config": {
> "path": "view.custom.clipboard"
> },
> "type": "property"
> }
> }
> },
> "type": "ia.display.markdown"
> }
> ],
> "meta": {
> "name": "FlexContainer"
> },
> "position": {
> "height": 200,
> "width": 200,
> "x": 499,
> "y": 211
> },
> "props": {
> "direction": "column"
> },
> "type": "ia.container.flex"
> },
> {
> "children": [
> {
> "meta": {
> "name": "Label"
> },
> "props": {
> "text": "This"
> },
> "type": "ia.display.label"
> },
> {
> "meta": {
> "name": "Label_0"
> },
> "props": {
> "text": "That"
> },
> "type": "ia.display.label"
> },
> {
> "meta": {
> "name": "Label_1"
> },
> "props": {
> "text": "Those"
> },
> "type": "ia.display.label"
> },
> {
> "meta": {
> "name": "Label_2"
> },
> "props": {
> "text": "Other"
> },
> "type": "ia.display.label"
> }
> ],
> "meta": {
> "name": "FlexContainer_0"
> },
> "position": {
> "height": 200,
> "width": 200,
> "x": 200,
> "y": 211
> },
> "props": {
> "direction": "column",
> "style": {
> "gap": "1rem"
> }
> },
> "type": "ia.container.flex"
> }
> ],
> "meta": {
> "name": "root"
> },
> "type": "ia.container.coord"
> }
> }
> 
> ```

---

_[View the full topic](https://forum.inductiveautomation.com/t/accessing-clipboard-in-perspective/100741)._
