micmonay / keybd_event

For simulate key press in Linux, Windows and Mac in golang
MIT License
380 stars 57 forks source link

VK_CAPSLOCK is invalid #29

Closed zj360202 closed 3 years ago

zj360202 commented 3 years ago

kb.SetKeys(keybd_event.VK_CAPSLOCK) kb.SetKeys(keybd_event.VK_A) kb.Launching() kb.Clear() kb.SetKeys(keybd_event.VK_CAPSLOCK) kb.SetKeys(keybd_event.VK_A) kb.Launching()

output: aa

micmonay commented 3 years ago

Hi

kb.SetKeys remove old selection, use AddKey instead of SetKeys or SetKeys(keybd_event.VK_CAPSLOCK,keybd_event.VK_A). But the best solutions for your example is :

// Set shift to be pressed
kb.HasSHIFT(true) 
kb.SetKeys(keybd_event.VK_A) 

that solution is it ok for you ?

Best reguard

zj360202 commented 3 years ago

thank you

labulakalia commented 3 years ago

CAPS in my Mac will change my input method,but I run it

kb.SetKeys(keybd_event.VK_CAPSLOCK)
err = kb.Launching()
if err != nil {
panic(err)
}

not change my input method is support CAPSLOCK?