(How) Can I pass a keystroke as a parameter value to a subroutine?

Some of my macros share 3 different, but almost equal, subroutines to get credentials from 1Password (username, password, and OTP). The only difference between these three subroutines is the keystroke to simulate in the 1Password GUI (⌘C, ⇧⌘C, and ⌥⌘C).

(How) Can I Pass that keystroke as a parameter value to a subroutine?

(Then I could write/use 1 subroutine instead of 3)

Hey Rob,

You can't pass a keystroke – only plain text.

But you could send any of these as text: ⌘C, ⇧⌘C, and ⌥⌘C

And then use a switch-action to send an actual keystroke.

-Chris

image

2 Likes

Should have thought of the switch... (there's so much I still have to learn about the power of KM)

Will probably use the "cases" "username", "password" and "otp", but your suggestion put me on the right track. Thanks!

1 Like