LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Simulate Key Event ">"

Does anybody know how to simulate keys that are only available while holding down the shift key? I have a VI that is based on an API that simulates key events, including the shift key. It works great. But I do not know how to get characters, such as ">", that are combinations of the shift key. It seems to me that just sending the code for the shift key and then the code for "." generates two events and only results in the "." since the shift key was not kept down... Any help in this issue is very welcome!! Thanks! /Mikael (LV 6.1)
0 Kudos
Message 1 of 6
(3,927 Views)
Look up an ASCII chart. The ASCII code for ">" is 62. There is a "keybd_event" function inside user32.dll. It's syntax is:
void keybd_event(unsigned char bVk, unsigned char bScan, unsigned long dwFlags, unsigned long dwExtraInfo);
Use the Call Library Function Node to call this function. Wire the ASCII code (62) to the first U8 input, and 0 to the next three inputs. This simulates the key being pressed. Then pause for a few milliseconds. Then call the function again, wire the ASCII code to the first U8, wire 2 to the first U32, wire 0 to the other U8 and U32. This simulates releasing the key. You can simulate any keystroke by using this function and the ASCII code. You must use it twice, once for key down and once for key up.
- tbob

Inventor of the WORM Global
Message 2 of 6
(3,924 Views)
Tbob,
Thanks for your reply! I am using that event function myself and I do wire it as you said. However, it seems that it only works for alphanumerics and some function keys. I had tried this the ASCII code for the ">" character at first but when that failed I took a closer look at it. I now can simulate the shift key being down and generate upper case and lower case letters. But no luck with the ">" sign as of yet... If you have more ideas, please let me know. Thanks again!
/Mikael
0 Kudos
Message 3 of 6
(3,925 Views)
Hello, i am looking for a Vi that simulates keystrokes, if possible by pressing a buttom. Is this Vi avaliable you use?

Thanks
Lukas
Lukas
0 Kudos
Message 4 of 6
(3,840 Views)
Could you clarify exactly what you want? What kind of button are you pressing and what keystroke do you want to simulate?
(It would not make much sense to simulate a keystroke by pressing a key ;))
0 Kudos
Message 5 of 6
(3,831 Views)
Mikael, have you tried the following combination: Shift key down, period key down, period key up, shift key up. ">" on the keyboard is achieved by shift-period. "<" is shift-comma. If this does not work, I'm at a loss to explain why?
- tbob

Inventor of the WORM Global
0 Kudos
Message 6 of 6
(3,816 Views)