<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Setting the clipboard text sequentially in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/setting-the-clipboard-text-sequentially/m-p/12279948#M18213</link>
    <description>&lt;P&gt;Eh, thanks for the help. It's not a critical thing and I spent too much time on it today anyways. I tried an ugly workaround by popping up the message box and then using sendkeys to hit the "enter" key, but I'm running into the same issue. The sendkeys doesn't fire until after the message box has been closed by the user.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think there's some windows.forms message queueing situation that's above my head. Like I somehow need to open a thread, setText on the clipboard, close the thread, and then do that same operation again.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Edit: the AddReference you sent does give me access to that member of system.windows, but it still seems to be queuing commands in the same way.&lt;/P&gt;</description>
    <pubDate>Mon, 02 Oct 2023 17:08:22 GMT</pubDate>
    <dc:creator>nbonnett-murphy</dc:creator>
    <dc:date>2023-10-02T17:08:22Z</dc:date>
    <item>
      <title>Setting the clipboard text sequentially</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/setting-the-clipboard-text-sequentially/m-p/12279407#M18208</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to push text to the clipboard 2 times in a row. I know it's an unusual thing to do, but I like to use the clipboard history feature of windows (start+v). So as part of a larger "fast info" script, I want to push the part description onto the clipboard, then as a separate operation, push the part number.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is what I have now:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;Imports System.Windows.Forms&lt;BR /&gt;Clipboard&lt;/SPAN&gt;.&lt;SPAN&gt;SetText&lt;/SPAN&gt;(&lt;SPAN&gt;ITEMPropertySet&lt;/SPAN&gt;.&lt;SPAN&gt;Item&lt;/SPAN&gt;(&lt;SPAN&gt;"Description"&lt;/SPAN&gt;).&lt;SPAN&gt;Value&lt;/SPAN&gt;) &lt;BR /&gt;&lt;SPAN&gt;Clipboard&lt;/SPAN&gt;.&lt;SPAN&gt;SetText&lt;/SPAN&gt;(&lt;SPAN&gt;ITEMPropertySet&lt;/SPAN&gt;.&lt;SPAN&gt;Item&lt;/SPAN&gt;(&lt;SPAN&gt;"Part Number"&lt;/SPAN&gt;).&lt;SPAN&gt;Value&lt;/SPAN&gt;)&lt;/PRE&gt;&lt;P&gt;The problem is that it only shows the part number in the clipboard history, which makes sense, since I set it then immediately over write it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I go like this:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;Imports System.Windows.Forms&lt;BR /&gt;Clipboard&lt;/SPAN&gt;.&lt;SPAN&gt;SetText&lt;/SPAN&gt;(&lt;SPAN&gt;ITEMPropertySet&lt;/SPAN&gt;.&lt;SPAN&gt;Item&lt;/SPAN&gt;(&lt;SPAN&gt;"Description"&lt;/SPAN&gt;).&lt;SPAN&gt;Value&lt;/SPAN&gt;)&lt;BR /&gt;msgbox("this is a message box") &lt;BR /&gt;&lt;SPAN&gt;Clipboard&lt;/SPAN&gt;.&lt;SPAN&gt;SetText&lt;/SPAN&gt;(&lt;SPAN&gt;ITEMPropertySet&lt;/SPAN&gt;.&lt;SPAN&gt;Item&lt;/SPAN&gt;(&lt;SPAN&gt;"Part Number"&lt;/SPAN&gt;).&lt;SPAN&gt;Value&lt;/SPAN&gt;)&lt;/PRE&gt;&lt;P&gt;Then both properties show up in the history. I'm gathering from this that the message box causes some sort of "go" or "update" or "execute" operation to happen that commits the clipboard text setting. Is there a way that I can force this to happen?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I had high hopes for system.windows.forms.application.DoEvents(), but that doesn't seem to work as expected.&lt;/P&gt;</description>
      <pubDate>Mon, 02 Oct 2023 14:04:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/setting-the-clipboard-text-sequentially/m-p/12279407#M18208</guid>
      <dc:creator>nbonnett-murphy</dc:creator>
      <dc:date>2023-10-02T14:04:16Z</dc:date>
    </item>
    <item>
      <title>Re: Setting the clipboard text sequentially</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/setting-the-clipboard-text-sequentially/m-p/12279546#M18209</link>
      <description>&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/dotnet/api/system.windows.clipboard.settext?view=windowsdesktop-7.0" target="_blank" rel="noopener"&gt;https://learn.microsoft.com/en-us/dotnet/api/system.windows.clipboard.settext?view=windowsdesktop-7.0&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Try use a different Clipboard: system.windows.clipboard&lt;/P&gt;&lt;P&gt;instead of: system.windows.forms.clipboard&lt;/P&gt;&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/dotnet/api/system.windows.forms.clipboard.settext?view=windowsdesktop-7.0" target="_blank"&gt;https://learn.microsoft.com/en-us/dotnet/api/system.windows.forms.clipboard.settext?view=windowsdesktop-7.0&lt;/A&gt;&lt;/P&gt;&lt;P&gt;This one clear clipboard before adding text&lt;/P&gt;</description>
      <pubDate>Mon, 02 Oct 2023 14:27:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/setting-the-clipboard-text-sequentially/m-p/12279546#M18209</guid>
      <dc:creator>Frederick_Law</dc:creator>
      <dc:date>2023-10-02T14:27:33Z</dc:date>
    </item>
    <item>
      <title>Re: Setting the clipboard text sequentially</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/setting-the-clipboard-text-sequentially/m-p/12279758#M18210</link>
      <description>&lt;P&gt;I don't seem to have access to the system.windows.clipboard class, just the forms one. I get a "not a member" error if I leave out forms.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think I see what you're saying though. By messing around with system.windows.forms.clipboard.clear and .settext, I'm gathering that it's the automatic clearing that's wiping out the data I want to see in the clipboard.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there some secret to getting at the system.windows namespace?&lt;/P&gt;</description>
      <pubDate>Mon, 02 Oct 2023 15:52:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/setting-the-clipboard-text-sequentially/m-p/12279758#M18210</guid>
      <dc:creator>nbonnett-murphy</dc:creator>
      <dc:date>2023-10-02T15:52:22Z</dc:date>
    </item>
    <item>
      <title>Re: Setting the clipboard text sequentially</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/setting-the-clipboard-text-sequentially/m-p/12279887#M18211</link>
      <description>&lt;P&gt;I can't get to it in iLogic either.&lt;/P&gt;</description>
      <pubDate>Mon, 02 Oct 2023 16:40:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/setting-the-clipboard-text-sequentially/m-p/12279887#M18211</guid>
      <dc:creator>Frederick_Law</dc:creator>
      <dc:date>2023-10-02T16:40:35Z</dc:date>
    </item>
    <item>
      <title>Re: Setting the clipboard text sequentially</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/setting-the-clipboard-text-sequentially/m-p/12279946#M18212</link>
      <description>&lt;P&gt;Found out how to add reference here:&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/koechlm/iLogic-Filter-Configurator/tree/master/WpfApp1" target="_blank"&gt;https://github.com/koechlm/iLogic-Filter-Configurator/tree/master/WpfApp1&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Add these to header:&lt;/P&gt;&lt;LI-CODE lang="visual-basic"&gt;AddReference "PresentationFramework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
AddReference "PresentationCore, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"&lt;/LI-CODE&gt;&lt;P&gt;Maybe only one of them is needed.&lt;/P&gt;&lt;P&gt;Somehow it made the rule "unsafe".&lt;/P&gt;&lt;P&gt;I did add text to clipboard.&lt;/P&gt;</description>
      <pubDate>Mon, 02 Oct 2023 17:03:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/setting-the-clipboard-text-sequentially/m-p/12279946#M18212</guid>
      <dc:creator>Frederick_Law</dc:creator>
      <dc:date>2023-10-02T17:03:12Z</dc:date>
    </item>
    <item>
      <title>Re: Setting the clipboard text sequentially</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/setting-the-clipboard-text-sequentially/m-p/12279948#M18213</link>
      <description>&lt;P&gt;Eh, thanks for the help. It's not a critical thing and I spent too much time on it today anyways. I tried an ugly workaround by popping up the message box and then using sendkeys to hit the "enter" key, but I'm running into the same issue. The sendkeys doesn't fire until after the message box has been closed by the user.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think there's some windows.forms message queueing situation that's above my head. Like I somehow need to open a thread, setText on the clipboard, close the thread, and then do that same operation again.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Edit: the AddReference you sent does give me access to that member of system.windows, but it still seems to be queuing commands in the same way.&lt;/P&gt;</description>
      <pubDate>Mon, 02 Oct 2023 17:08:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/setting-the-clipboard-text-sequentially/m-p/12279948#M18213</guid>
      <dc:creator>nbonnett-murphy</dc:creator>
      <dc:date>2023-10-02T17:08:22Z</dc:date>
    </item>
    <item>
      <title>Re: Setting the clipboard text sequentially</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/setting-the-clipboard-text-sequentially/m-p/12279982#M18214</link>
      <description>&lt;P&gt;Interesting results:&lt;/P&gt;&lt;LI-CODE lang="visual-basic"&gt;Sub Main()
	System.Windows.Clipboard.SetText("abc")
	Logger.Info(System.Windows.Clipboard.GetText)
	System.Windows.Clipboard.Flush
	System.Windows.Clipboard.SetText("1234")
	Logger.Info(System.Windows.Clipboard.GetText)
	System.Windows.Clipboard.Flush
	System.Windows.Clipboard.SetText("abcde1234")
	Logger.Info(System.Windows.Clipboard.GetText)
	System.Windows.Clipboard.Flush
End Sub&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;They're in the clipboard but not in the clipboard&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":dizzy_face:"&gt;😵&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Oct 2023 17:22:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/setting-the-clipboard-text-sequentially/m-p/12279982#M18214</guid>
      <dc:creator>Frederick_Law</dc:creator>
      <dc:date>2023-10-02T17:22:03Z</dc:date>
    </item>
    <item>
      <title>Re: Setting the clipboard text sequentially</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/setting-the-clipboard-text-sequentially/m-p/12280003#M18215</link>
      <description>&lt;P&gt;Got it.&lt;/P&gt;&lt;P&gt;This works:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="visual-basic"&gt;imports System.Windows.Forms
Sub Main()
	System.Windows.Forms.Clipboard.SetText("abc")
	System.Threading.Thread.CurrentThread.Sleep(250)
	System.Windows.Forms.Clipboard.SetText("1234")
	System.Threading.Thread.CurrentThread.Sleep(250)
	System.Windows.Forms.Clipboard.SetText("abcde1234")
	System.Threading.Thread.CurrentThread.Sleep(250)
End Sub&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Oct 2023 17:41:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/setting-the-clipboard-text-sequentially/m-p/12280003#M18215</guid>
      <dc:creator>Frederick_Law</dc:creator>
      <dc:date>2023-10-02T17:41:27Z</dc:date>
    </item>
    <item>
      <title>Re: Setting the clipboard text sequentially</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/setting-the-clipboard-text-sequentially/m-p/12282743#M18216</link>
      <description>&lt;P&gt;Awesome thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I also tried to use "getText" between the sets but had, I assume, the same results that you did. I'm surprised that sleep works and I'd love to find out what exactly the trigger is to "lock it in".&lt;/P&gt;</description>
      <pubDate>Tue, 03 Oct 2023 19:40:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/setting-the-clipboard-text-sequentially/m-p/12282743#M18216</guid>
      <dc:creator>nbonnett-murphy</dc:creator>
      <dc:date>2023-10-03T19:40:57Z</dc:date>
    </item>
    <item>
      <title>Re: Setting the clipboard text sequentially</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/setting-the-clipboard-text-sequentially/m-p/12282751#M18217</link>
      <description>&lt;P&gt;Saw it while searching about clipboard.&lt;/P&gt;&lt;P&gt;Sleep(200) didn't work.&amp;nbsp; You can test and find the lowest number that works.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Oct 2023 19:45:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/setting-the-clipboard-text-sequentially/m-p/12282751#M18217</guid>
      <dc:creator>Frederick_Law</dc:creator>
      <dc:date>2023-10-03T19:45:05Z</dc:date>
    </item>
  </channel>
</rss>

