LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

getting char form keybaoard

Hi,

 

I am not able to get any output out of this. Characters are just disapearing.

 

Some help needed please.

0 Kudos
Message 11 of 17
(989 Views)

Hi,

 

I modified your VI and I think this will do what you want at a very basic level.  There are three indicators:

1.  Shows the keys that were pressed that time through the while loop

2.  Shows the accumulated keys that were pressed the entire time the loop has been running

3.  The spreadsheet view of all the keys pressed while the program ran

 

If you have any questions please let me know.

 

Regards,

 

Greg H.

Applications Engineer
National Instruments
0 Kudos
Message 12 of 17
(971 Views)

I believe the reason you are having trouble is that you are leaving the LabVIEW environment. You will have to make windows call to do this. If you do a search I remember that altenbach had an example of using windows API call for this. I will try and see if I can find it and link it here.

Tim
GHSP
0 Kudos
Message 13 of 17
(965 Views)

Here is a link to the thread that I was thinking about

 

http://forums.ni.com/t5/LabVIEW/Can-LabVIEW-control-another-program-or-emulate-keys-pressed-on/m-p/9...

 

 

It is more complex and you will need to understand how to make this happen.

Tim
GHSP
0 Kudos
Message 14 of 17
(962 Views)

Here is another link to help. This is a link to the Microsoft MSDN

 

http://msdn.microsoft.com/en-us/library/ms646267

Tim
GHSP
0 Kudos
Message 15 of 17
(961 Views)

Hi, I am having some difficulty with what Greg proposed. See the above attachment from Greg. Each time I am typing I get several character just for the same key. Say I type A, I will get AA or AAAA ....

 

Anyway to fix it?

 

Also is it possible to stop some Y and Z key from displaying...?

 

Thank you.

0 Kudos
Message 16 of 17
(937 Views)

Hi,

 

The reason you are getting duplicates of the same key is because the loop is executing so fast it is registering each keystroke multiple times.  So between when you press and release the "A" key, the program has read the current state of all the keys multiple times before the "A" key is no longer pressed.  Ways to avoid this are:

1.  Add a wait to the loop (however this can result in missing keystrokes entirely)

2.  Compare the previous keystroke to the next and if they are the same ignore it (however if you actually press "A" then "A" it will not register properly)

3.  Using a combination of 1 and 2 with either an event structure or a producer/consumer loop is probably your best bet.

 

Use a case structure to filter the Y and Z keys.  If it is a Y or Z do not record it.

 

Regards,

 

Greg H.

Applications Engineer
National Instruments
0 Kudos
Message 17 of 17
(928 Views)