LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Enter data where blinking cursor (caret) is

Solved!
Go to solution

I am working on a project that will take data from a device (i.e. weight balance, Mitutoyo Indicator, force gauge, etc) and place the data output wherever the blinking cursor is. I have gone the route of taking the data and placing this into the Clipboard by using the App.Clipboard.Write Invoke Node to save the data to the clipboard and App.Clipboard.Read Invoke Node to extract the data point.

 

Right now, the data will be saved to a MS Access Form with a textbox but I want to make this scale-able to any program regardless if where the blinking cursor is stationed. Has anyone progmatically found where the blinking cursor is or might have any idea how this might be done?

0 Kudos
Message 1 of 5
(2,260 Views)

I read that AutoIt can do it here.

 

Or does it have to be LabVIEW code? Then I searched and found e.g. this that could be useful.

Certified LabVIEW Architect
0 Kudos
Message 2 of 5
(2,196 Views)

I'd like it to be encapsulated all inside LabVIEW. I'll look into the Windows APIs for the FindWindow and FindWindowEx functions. Thank you.

0 Kudos
Message 3 of 5
(2,183 Views)
Solution
Accepted by topic author Eric1977

This turned out to be much simpler than I had originally thought. Using the SendKeys.SendWait method of the .NET System.Windows.Forms namespace, I can send keystrokes to any program as long as either the caret/cursor is present for the active window or, in the case of Excel (the Active Cell), it will paste/type the data as if it was sent using a keyboard.

 

And I was freaking out about getting neck deep into the Windows API.

0 Kudos
Message 4 of 5
(2,169 Views)

Good to hear. I remember now that I have used this to send keys to Windows: https://forums.ni.com/t5/Example-Code/Programmatically-Simulate-Key-Strokes-in-LabVIEW/ta-p/3521756?...

 

It uses user32.dll's "keybd_event".

Certified LabVIEW Architect
0 Kudos
Message 5 of 5
(2,134 Views)