Getting function keys and page up/down

I’m just trying to use keyboard input, with limited luck. (I have a logitech R400 presenter remote, which makes page up/down, period and F5 key presses).

The period was fine, as that’s in the keyboard chop standards. But, from there:

I tried to make a script (python) which checks the keystate() expression - that script fails, saying keystate isn’t known.

I’m not sure about how to make the alternate ‘panel execute’ method work… can I make a panel that listens to all keystrokes, all the time, that way? Is there a sample that shows how to build this setup?

Then I found /local/shortcuts. F5 is in there, but doesn’t seem to be ‘mapped’ to anything. Can I use that table to intercept F5 and convert it to another key?

And in that case (or in any case), I can’t find how to specify the page up and page down keys at all.

Any clues please?

Bruce

Found the touch shortcuts… which is global. I changed ‘F5’ to ‘5’ instead, but it throws a python error, as opposed to simulating a key press. I guess I need to define some python functions to have the shortcuts fire?

Then would need to know how page up and page down are represented in the short-cuts list syntax (they aren’t there, as far as I can tell).

Bruce

There is a new Keyboard DAT that will be making this much easier to work with. Not sure if it’s yet it in the latest experimental.

It’s not quite released, but it will make it much easier.
But in the meantime, you can look at how function keys are used to drive this old example from 077 using shortcuts defined in Puzzle/Panel/local/shortcuts.
The commands are tscript, though they can run either a tscript of python DAT.
-Rob
puzzle.tox (4.9 KB)

I’ll take a look, thanks!

New keyboard widget would be cool though. The way it works now is perfect, except for the keys it doesn’t detect.

Bruce

OK, so I found the shortcuts for the panel, and it runs a script in a text DAT? Or the function that the script defined?

I can probably work with that - put a DAT in with the global shortcuts with an operator of some kind.

And - page up and page down keys? How do I specify those in shortcuts?

Bruce

Edit - I have F5 triggering a DAT called ‘global_F5’ in the root of my network. I’m using that to trigger a button. Just the page up and down keys… is that possible?

Hi

Pageup/pagedown are specified by pgup pgdn in this system of shortcuts.
In the puzzle example, each keyboard entry executes a line of tscript.
For example: up run move 0 -1
Will execute “run move 0 -1” when pressing up, where move is a DAT named move.
We will have the Keyboard DAT out shortly too though.

Cheers
Rob

They don’t work in the TouchShortcuts file, in 088 current build.

Bruce

Hm. Youre right.
Seems in this system pageup looks like capital Z and pagedown looks like bracket: ]
Can you try with those constants instead?
(assuming youre okay with Z, and ] also having the same function?)

Ive verified it will work correctly in the new Keyboard In DAT

They must be different here. How did you work that out?

Bruce

I stepped through the code :wink:
You could also use a Panel Execute on the ‘key’ value and print when that changes.

FYI - the F5 key almost gave me a conniption fit. Half the time it would trigger my custom script (which ran a text DAT), then other times it would drop my window out of perform mode (BOOM - desktop!), and occasionally would open the errors dialog (the original F5 function that should have been masked).

The one key I could trigger from a keyboard OP was perfect. Looking forward to the new Keyboard OP.

I’ll post the result - but you guys seem to track everything down on Vimeo anyway!

Bruce

Sorry should have mentioned this a few days ago, but the Keyboard In DAT is in the latest experimental download.
Should make life easier:

derivative.ca/088/Downloads/Experimental.asp

-Rob