Skip to main content
rechmbrs
Inspiring
February 6, 2019
Question

Copy Clipboard to text

  • February 6, 2019
  • 1 reply
  • 1180 views

I just found this while searching for copy Clipboard to Text :

    function copyTextToClipboard(txt)

    {

      const keyTextData = app.charIDToTypeID('TxtD');

      const ktextToClipboardStr = app.stringIDToTypeID("textToClipboard");

      var textStrDesc = new ActionDescriptor();

      textStrDesc.putString(keyTextData, txt);

      executeAction(ktextToClipboardStr, textStrDesc, DialogModes.NO);

    }

How might I change this to do the opposite of the code above?    Couldn't find textFromClipboard or clipboardToText in search.

Thanks,

RONC

PS will new Plugin For VisualStudioCode to replace ESTK handle bringing Actions to JSX the same as now?

This topic has been closed for replies.

1 reply

JJMack
Community Expert
Community Expert
February 6, 2019

Text from the clipboard is Ctrl+V or CMD+V Paste. The script code you posted is Action Manager code that Adobe Plug-in Scriptlistener recorded in its VBS log on someone's desktop the programmer modified the code to turn it into a function they use scipting Photoshop.

There is DOM support for paste  the javaScript form would be app.activeDocument.paste() a true parm would make it a past into. I do not know anything about VBS and only hack at javascript.     appRef.ActiveDocument.Paste() vbs

In Photoshop you can Paste Text into Photoshop Text  tool in input or edit mode but, you can not paste text into a a layer. Paste normally create a raster image layer.  You you need to add an art layer then make the layer kind text and set all the attributes and set its content.

JJMack