2. Is it possible to create a small single file executable from a gawk
program that will do #1?
% 1. Is is possible to use gawk to read the Windows clipboard, make a
% transformation of the text there and then replace the clipboard text
% with the transformed text?
Not as such. It's possible to write an extension function to retrieve
and replace the clipboard text, but you'd have to do that part in
C or some other compiled language. Also, support for extension functions
might not be compiled in to any binary distributions, so you might have
to compile gawk from sources to get it.
% 2. Is it possible to create a small single file executable from a gawk
% program that will do #1?
No. Or at least, not without changing the gawk source code and recompiling
it.
You can do this with Rexx, using the Regina interpreter, Rexx/Wrapper, and
my w32funcs package. You'll still need a C compiler, although Rexx/Wrapper
will generate the C code. Also, your executable will need to be distributed
with a couple of .dlls.
--
Patrick TJ McPhee
East York Canada
pt...@interlog.com
% In article <ffd662ea.03100...@posting.google.com>,
% Grod <ggroth...@volcanomail.com> wrote:
%
% % 1. Is is possible to use gawk to read the Windows clipboard, make a
% % transformation of the text there and then replace the clipboard text
% % with the transformed text?
%
% Not as such.
Sorry, I got so caught up going on about difficult ways of dealing with the
issue, I forgot the easy way. unxutils (http://unxutils.sf.net) has a
program which writes the text content of the clipboard to stdout, and
another which writes its stdin to the clipboard, so you can
BEGIN { incmd = "gclip"; outcmd = "pclip"
while (incmd | getline) {
var = do_something($0, var)
}
close(incmd)
print var | outcmd
close(outcmd)
}
(note that this is not tested).
Only mildly off-topic (since this thread specifically mentions GAWK), you
can also do it with TAWK - and it does (*) go all into one big executable,
with no DLLs (and no tricky "extracting out the DLLs to the current
directory" at runtime tricks)
(*) Read "does" as "can". It is also possible to go the small executable
route.
On Sun, 05 Oct 2003 20:37:02 GMT, Kenny McCormack wrote:
> Only mildly off-topic (since this thread specifically mentions GAWK), you
> can also do it with TAWK - and it does (*) go all into one big executable,
> with no DLLs (and no tricky "extracting out the DLLs to the current
> directory" at runtime tricks)
>
> (*) Read "does" as "can". It is also possible to go the small executable
> route.
I beleive this was not off-topic at all. Really the TAWK language doesn't
differ from standard awk so much. And if the program calls the utils from
unxutils itself, we get a solution consisting only of three executables.
It this is what is needed, it should be worth buying TAWK.
Stepan