Skip to main content
Inspiring
November 2, 2021
Question

Read the clipboard inside a jsx

  • November 2, 2021
  • 1 reply
  • 519 views

I'm trying to transfer data from some programs to AE and the most simple way to do it would be using the clipboard. Or so I thought. 

I managed to get it pasted into an edittext field and read that, worked great, but it's limited to 30,000 chars, which seems like a lot, but once you deal with matrices as strings it's not.

I found a script for ID that captures the event.originalEvent after the user pastes inside the application. Is there a method similar to that for AE edittext fields?

How can I find out what attributes an event has?

function onMyTextChanged(event) { /*reat the event*/ }

I found event.target.text for example, that helps or I can close the event.target.parent window immediately, but I'd like to know what else I can read from the passed event argument. Any Pointers?

 

This topic has been closed for replies.

1 reply

Mathias Moehl
Community Expert
Community Expert
November 6, 2021

I think the only way to read the clipboard in a script is to use

callSystem

https://ae-scripting.docsforadobe.dev/general/system.html#system-callsystem

and then call a system command that reads the clipboard.

I use this to write the content of the clipboard to a file on Mac OS

system.callSystem("pbpaste -Prefer txt >" + tempFile.fsName);
 
Mathias Möhl - Developer of tools like BeatEdit and Automation Blocks for Premiere Pro and After Effects
Inspiring
November 9, 2021

Thanks, that helps. But I really don't want to write files or access the cmd.exe, I'm writing a plug-in and I don't want to scare people using it. I was hoping to intercept the "original event" which would have been the paste command of the user.