String to windows clipboard [solved]

MikeDMikeD Posts: 291

Hi all,

Does anyone know how to pass a string from DAZ script to Windows clipboard? I have seen the DzProperty.copyToClipboard() but this is for properties or their values.

I have checked the objects in the Object Index but I haven't found something that is related to Windows Clipboard unless I have missed something in sarching....

 

Thanks in advance

Post edited by MikeD on

Comments

  • The only scripts I know which pass to (or get from) the clipboard use a text box, and rely on the user doing the copy/paste operation from/to that.

  • MikeDMikeD Posts: 291

    The only scripts I know which pass to (or get from) the clipboard use a text box, and rely on the user doing the copy/paste operation from/to that.

    Thank you very much for the reply Richard. I have made a script that reads any pJCM that fired up when a figure node is translated. I would like to auto copy the name of the pJCM to the windows clipboard in order to use it to the morph name that will be created in the external program like ZBrush when we create the corresponding pJCMs. (The script also batch load all pJCMs and FBMs using the morph names). It would be convinient to auto pass the name of the JCM to the clipboard, but if I can't find any other solution I will make a text box. I have also thought to use the text box, as you said and than use an action to copy it, but the 'DzCopyNodeAction' is the closest I could find, and I don't think that it would do the work .... If nothing else will work then I will give the script to the other PAs with the instruction to copy the name from a text box.

    Thanks again for your reply!

  • MikeDMikeD Posts: 291
    edited November 2018

    Well I have found a trick that copies the string to the clipboard. After the respond from Richard I made a deeper digging and I found that if I have a hidden text box, I can pass the string to the text property and then by using the .copy() method the string passes to the clipboard without being seen by the user. It may be simple and Rob may laugh by the unorthodox of the solution, but it is the only one I have found. Check the example:

     

    var txtToClipboard = new DzTextEdit(parentWidget);txtToClipboard .hide();when you need to copy to the clipboard the sString:txtToClipboard .text = sString;txtToClipboard .selectAll();txtToClipboard .copy();

     

    That solution worked for me.

    Post edited by MikeD on
  • Neat solution.

Sign In or Register to comment.