How do I copy some text to the clipboard from Mechanical?

Pierre Thieffry
Pierre Thieffry Member, Moderator, Employee Posts: 107
25 Answers Second Anniversary 10 Comments 25 Likes
✭✭✭✭
edited June 2023 in Structures

How can we make some text available to the user from the clipboard?

Tagged:

Answers

  • James Derrick
    James Derrick Administrator, Employee Posts: 269
    Ancient Membership 100 Comments 100 Likes 25 Answers
    admin

    Hi @Pierre Thieffry Can you move your answer to an answer and accept it please? At the moment this question looks unanswered so people aren't likely to realise it is a solved problem!

  • Pierre Thieffry
    Pierre Thieffry Member, Moderator, Employee Posts: 107
    25 Answers Second Anniversary 10 Comments 25 Likes
    ✭✭✭✭
    Answer ✓

    Fairly simple code...

    clr.AddReference('System.Windows.Forms')
    from System.Windows.Forms import Clipboard
    
    Clipboard.SetText('My text to the clipboard)