LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Anybody knows how to do send key function ?

Highlighted
Hello all,
               Anybody know how to do send key function ?
demand is below,
as run the program, program can simulate keyboard type function, input charaters for the other appliction or program window, e.g.
run program, program window would be set to bottom (I can achieve this states), and input key word for the other window, operation is the same as keyboard and mouse input manually.
and which command can disable/restore keyboard and mouse function ?
can labVIEW achieve this ? thanks @!
 
 
 
0 Kudos
Message 1 of 7
(4,775 Views)
Highlighted
This vi uses the user32.dll function "keyboard_event" to send the characters in a string.  I've never used it so I hope it works.
 
- tbob

Inventor of the WORM Global
Message 2 of 7
(4,761 Views)
Highlighted
tbob,
          thank you for your powerful help, it works (I have tried "Tab" function).
BTW ,how can I disable/restore keyboard and mouse function ?
0 Kudos
Message 3 of 7
(4,752 Views)
Highlighted
I don't know if there is a way to disable keyboard and mouse, but you could create an event structure and add event cases for keyboard and mouse functions using the filter events, Key Down? and Mouse Down?.  These are found under <This VI> event selection.  For both cases, wire a True constant to the Discard terminal on the right side of the event structure.  That way, any key pressed or mouse click will be discarded.  You may have to also add the Key Repeat? event.
In order to enable again, instead of wiring the True constant, you would have to create a True/False condition (like a Disable button), and wire the output of this condition into the event structure to be wired to each Discard terminal.  Remember, a True condition will Disable the keyboard and mouse.
- tbob

Inventor of the WORM Global
0 Kudos
Message 4 of 7
(4,737 Views)
Highlighted
tbob,
         I found the SendKey.Vi has some bugs, example, input "abcd" to sendkey for "notepad", I found the characters is 1234,
Sendkey "ABCD" the characters is "abcd", send "n" the key is ".(a point)" . I found "string to byte (type cast) transfer is correct, but user32.dll's response.....
________________________________________________________


Try to make everything Automatic
0 Kudos
Message 5 of 7
(4,710 Views)
Highlighted
Just how are you sending the keys to Notepad?  Sendkeys will cause the keycodes of the keys to be sent, just as if you pressed them on the keyboard.  "abcd" keycodes are hex 61, 62, 63, 64.  Perhaps this is showing up in Notepad as 1,2,3,4.  Whatever function you send the keys to must be able to take the keycodes and translate into characters.
- tbob

Inventor of the WORM Global
0 Kudos
Message 6 of 7
(4,674 Views)
Highlighted

I know this is an old post. And I totally understand how to send keys via the user32.dll; however I was wondering if anybody every figured out how to send the keys ( ) / \ -  none of them seem to work.

0 Kudos
Message 7 of 7
(108 Views)