Google Groupes n'accepte plus les nouveaux posts ni abonnements Usenet. Les contenus de l'historique resteront visibles.

Windows clipboard questions

16 vues
Accéder directement au premier message non lu

Grod

non lue,
4 oct. 2003, 08:16:1604/10/2003
à
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?

2. Is it possible to create a small single file executable from a gawk
program that will do #1?

Patrick TJ McPhee

non lue,
5 oct. 2003, 15:45:0705/10/2003
à
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. 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

Patrick TJ McPhee

non lue,
5 oct. 2003, 15:57:1405/10/2003
à
In article <blpsc3$3sq$1...@news.eusc.inter.net>,
Patrick TJ McPhee <pt...@interlog.com> wrote:

% 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).

Kenny McCormack

non lue,
5 oct. 2003, 16:37:0205/10/2003
à
In article <blpsc3$3sq$1...@news.eusc.inter.net>,
Patrick TJ McPhee <pt...@interlog.com> wrote:
...

>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.

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.

Stepan Kasal

non lue,
6 oct. 2003, 03:23:4106/10/2003
à
Hello,

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

0 nouveau message