www.ClassicTW.com
https://mail.black-squirrel.com/

Determining ANSI keycodes
https://mail.black-squirrel.com/viewtopic.php?f=15&t=30584
Page 1 of 1

Author:  ElderProphet [ Thu Nov 11, 2010 7:39 am ]
Post subject:  Determining ANSI keycodes

I wrote this quick code snippet the other day to share with a player who was looking to find additional keyboard triggers for launching scripts and such. This is a complete script that can help you determine the ANSI code for SHIFT+Q or F5 for example.

I wrote a more complex version years ago, primarily for the purposes of decoding the ANSI codes coming from the server, but this one is much simpler for the above tasks.

+EP+

Code:
echo "*Text Out Echo running.  Press ESC to exit.*"
setTextOutTrigger tot1 :tot1 ""
pause

:tot1
getOutText $out
getLength $out $length
setVar $keycodes ""
setVar $i 1
while ($i <= $length)
   cutText $out $char $i 1
   getCharCode $char $code
   setVar $keycodes $keycodes & "#" & $code
   add $i 1
end
echo "*Keycodes: " $keycodes "*"
# Now see if ESC was pressed
if ($length = 1) and ($out = #27)
   echo "*ESC detected, script exiting.*"
   halt
end
setTextOutTrigger tot1 :tot1 ""
pause

Author:  Parrothead [ Thu Nov 11, 2010 3:51 pm ]
Post subject:  Re: Determining ANSI keycodes

:start
settextouttrigger two :two
pause
:two
killtrigger two
getouttext $key
getCharCode $key $code
echo "*" & $key & $code
send #145
goto :start


Simpler and works with Swath

Author:  ElderProphet [ Fri Nov 19, 2010 11:26 pm ]
Post subject:  Re: Determining ANSI keycodes

That is fine if you want a simple keycode like A, but it will not work for batch codes like F5.

Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/