How to use KeyDown() in a button?

KeyDown() doesn't seem to work properly in a button. Here's a little demo:

@output:{=KeyDown("alt") ? "alt" : "not alt"=}
@output:{=KeyDown("ctrl") ? "ctrl" : "not ctrl"=}
@output:{=KeyDown("shift") ? "shift" : "not shift"=}
@output:{=KeyDown("none") ? "none" : "not none"=}

@output:---

@keydown:alt
@output:alt

@keydown:ctrl
@output:ctrl

@keydown:shift
@output:shift

@keydown:none
@output:none

@keydown:any
@output:any

@keydown:common
@output:common

@output:===
XML
<?xml version="1.0"?>
<button backcol="none" display="both" label_pos="right" textcol="none">
	<label>KeyDown</label>
	<icon1>#newcommand</icon1>
	<function type="normal">
		<instruction>@output:{=KeyDown(&quot;alt&quot;) ? &quot;alt&quot; : &quot;not alt&quot;=}</instruction>
		<instruction>@output:{=KeyDown(&quot;ctrl&quot;) ? &quot;ctrl&quot; : &quot;not ctrl&quot;=}</instruction>
		<instruction>@output:{=KeyDown(&quot;shift&quot;) ? &quot;shift&quot; : &quot;not shift&quot;=}</instruction>
		<instruction>@output:{=KeyDown(&quot;none&quot;) ? &quot;none&quot; : &quot;not none&quot;=}</instruction>
		<instruction />
		<instruction>@output:---</instruction>
		<instruction />
		<instruction>@keydown:alt</instruction>
		<instruction>@output:alt</instruction>
		<instruction />
		<instruction>@keydown:ctrl</instruction>
		<instruction>@output:ctrl</instruction>
		<instruction />
		<instruction>@keydown:shift</instruction>
		<instruction>@output:shift</instruction>
		<instruction />
		<instruction>@keydown:none</instruction>
		<instruction>@output:none</instruction>
		<instruction />
		<instruction>@keydown:any</instruction>
		<instruction>@output:any</instruction>
		<instruction />
		<instruction>@keydown:common</instruction>
		<instruction>@output:common</instruction>
		<instruction />
		<instruction>@output:===</instruction>
	</function>
</button>

@keydown gets it right, but KeyDown() always return none.

KeyDown

Thanks, fixed in the next version!

sorry for resurrecting an old thread, but you are quite the resource for smarts and wanted to ask you about this key function.

I have a button on my context menu to move something to my downloads folder by default, but if i hold ctrl it copies it. Is there a way for the button to change labels so that when I hold down ctrl it changes the label to "Copy to Downloads" instead of the default "Move to Downloads"?

Yes.

@label:KeyDown("ctrl") ? "Copy" : "Move"

@keydown:ctrl

Thank you dude. You're the Yoda around these parts in coding. Love it :winking_face_with_tongue: