I’m trying to access the clipboard in the Sanderling Bot window but to do so I need to include the line…
However the bot windows says System.Windows doesn’t have a Forms namespace.
Sorry - Should have searched better.
#r “System.Windows.Forms” at the top of the window.
If I remember correctly you will have problems with using the clipboard due to threading.
I believe I found a workaround/fix by creating a new thread , setting the ApartmentState to STA
here is a snippet I use
public static void SetText(string textToSet) => Clipboard.SetText(textToSet);
Thread thread = new Thread( () => SetText(string stringtoSet));
I have successfully used this to set the results from the ProbeScanner into the Clipboard and manipulated them outside of the Sanderling Environment.
Thanks for the code.
I did find out that “for some reason” I couldn’t read the ClipBoard so I used a file instead. I’ll give your solution a go.