Custom Library Scope?

I created a custom python library with a single function that copies text to the clipboard in windows. It appears that my library worked, because when I imported said function in the script console, it copied the input text to the clipboard, but when I tried running the same script in a perspective client whenever someone presses a button, nothing happened. No errors or anything. Any idea why this might be happening? Do custom libraries have scope?

Scripts in the Script Libraries, run in the scope that they are called from.

When you call the script from the script console, then it will run in Vison Client/Designer scope. (e.g. it will have access to your local machine).
When you call the same script from a perspective client then it will run in Gateway Scope. (e.g. it will not have access to your local machine).

Perspective Clients also run in a browser and as such are subject to browser securities.

Why do you need to copy text to the clipboard?

Thanks for the clarification!

I was just trying to experiment around; this isn't for any serious project or anything. I decided on copying text because it seemed like a simple but conceivably useful function.

Browser malware authors would love to have unrestricted access to the end user's clipboard. There is some, limited, support for this in web technologies, but it isn't available in Perspective.

1 Like

You can interact with the client's clipboard using my Periscope module, as long as you have a secure context.

2 Likes