[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Return Windows Clipboard string with LUA?
- From: Duck <duck@...>
- Date: Fri, 4 Apr 2008 07:22:59 +1100 (EST)
>Is there some function that returns the string
>in the windows clipboard?
Not in any of the standard libraries, since Lua is by design restricted to
ANSI C (and the Windows clipboard isn't part of that :-).
I haven't heard of any Lua addon to do this -- I imagined it would be
trivial to write one, but then I looked at the whole clipboard API and it
is a thing of absurd complexity and non-console-applicationness, ha. Tell
you what, with APIs like that, this Windows fad will never catch on with
But if you have or can find a little console utility program to dump the
clipboard (or even some VBScript) then you could easily write a Lua
function to get the helper utlity to do the work, e.g. using something
very crudely like this:
-- or os.execute("cscript myclipscript.vbs mytempfile")
local fil = io.open("mytempfile")
local clp = fil:read('*a')
I couldn't find such a utility, but if you can, please post because I have
just realised I have a very handy use for something like this myself!