Are you using Autocad or Bricscad? Autodesk removed the cursor control keys (arrows, PgUp, etc.) from GRREAD 10 years ago or so. I think the issue was that the older implementation did not return unique codes for all of the cursor control keys. In recent versions of Bricscad the cursor control keys have been added back. To prevent conflicting codes the cursor keys add 128 to the code returned. From the release notes for V17.2.06:
BRX LISP .NET VBA
"grread" function has been extended by a control bit flag 7 (= 128). This bit flag allows to retrieve extra keys which are otherwise not tracked: cursor keys, PgUp, PgDown, Home, End, Insert, Delete. Example : (grread nil (+ 2 128))
This is for the cursor controls keys only. The function keys above F2 do return codes with GRREAD. I think that F1 and F2 are omitted because they are dedicated to Help and showing the prompt history.
I use the following in an on-screen text editor to handle modified cursor keys:
(defun get-key (/ key loop result return temp)
(setq key (cadr (grread nil 130)))
(cond ( (vle-member key '(3 22 24)) ; C, V, X keys
(if (acet-sys-control-down) ; test for ^C, ^V, ^X
(setq key (+ key 400)) ; create a unique code
)
)
( (vle-member key '(291 292 293 294 295 296)) ; End, Home, Left, Up, Right, Down keys
(if (acet-sys-shift-down) ; shift down moves and selects
(setq key (+ key 200)) ; create a unique code
)
)
)
key
)
If you're running Autocad I'd recommend looking at AutoHotKey. Before Bricscad 'fixed' GRREAD I used AutoHotKey to add an escape code to cursor keystrokes. Here is partial code:
#NoEnv
#Persistent
#SingleInstance force
#UseHook on
Process, priority, , high
SetTitleMatchMode 1
SendMode Input
#ifWinActive BricsCAD
{
$Left::
if (GetKeys() = "t")
{
send @L
}
else
{
send {left}
}
Return
$+Left::
if (GetKeys() = "t")
{
send @l
}
else
{
send {left}
}
Return
}
GetKeys()
{
RegRead, keys, HKEY_CURRENT_USER, Environment, KeysOn
Return keys
}
The KeysOn registry key was set to 1 when the editor's key reading loop was active and to 0 otherwise.