EvilZone

Programming and Scripting => Scripting Languages => : noize July 21, 2013, 11:36:18 PM

: [Lua] Char to ASCII code
: noize July 21, 2013, 11:36:18 PM
Just a simple script that shows you the ASCII code for any keystroke (single keys or keycombos (e.g: SHIFT + F2)).


:

--[[----------------------------------------------------------------------
' filename: c2a.wlua
' author: noize
------------------------------------------------------------------------]]


require("iuplua")


prompt = iup.text {
expand = "YES",
value = "Press one or more keys",
tip = "Key combos are accepted as well",
}


output = iup.text {
value = "together",
expand = "YES",
}


function prompt:k_any(key)
prompt.value = ""
output.value = key
end


dlg = iup.dialog {
iup.vbox {
iup.frame {
iup.hbox {
prompt,
},
title = "ASCII char",
},
iup.frame {
iup.hbox {
output
},
title = "ASCII code",
},
margin = "5x5",
gap = "5",
},
title = "Char to ASCII",
size = "EIGHTH",
background = "255 255 255",
}


dlg:show()


iup.SetFocus(prompt)


iup.MainLoop()




A quick one.
: Re: [Lua] Char to ASCII code
: Xires July 22, 2013, 09:14:38 AM
Actually useful, ty.  Handy for WMs that use Lua scripting like ion.
: Re: [Lua] Char to ASCII code
: noize July 22, 2013, 10:13:01 PM
Actually useful, ty.  Handy for WMs that use Lua scripting like ion.


I know about Ion but I've never used it. How would this be more useful in Ion than in any other window manager? Or maybe, you were just naming Ion as it has Lua preinstalled?
: Re: [Lua] Char to ASCII code
: Xires July 23, 2013, 01:01:38 AM
I was naming ion as it uses lua for configuration and can be extended via lua scripts.