Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I want to use key code instead of string. #678

Open
VacantHusky opened this issue Aug 26, 2024 · 0 comments
Open

I want to use key code instead of string. #678

VacantHusky opened this issue Aug 26, 2024 · 0 comments

Comments

@VacantHusky
Copy link

I would like to add a function:

func KeyCode2String(key int) (k string, err error) {
	for keyStr, keyCode := range keyNames {
		if keyCode == C.int(key) {
			return keyStr, nil
		}
	}
	return "", errors.New("Invalid key specified.")
}

key, _ = KeyCode2String(112)  // F1
robotgo.KeyToggle(key)

But I can't use keyNames.

@github-staff github-staff deleted a comment from VacantHusky Aug 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
@VacantHusky and others