[Tutor] Replacing keyboard input to EXE file

Wayne srilyk at gmail.com
Fri Jun 12 14:27:23 CEST 2009


On Fri, Jun 12, 2009 at 2:49 AM, eShopping
<etrade.griffiths at dsl.pipex.com>wrote:

> <snip>
> Hm .....does this mean we are snookered on Win XP?


Well, strictly using python anyway. I'm not sure precisely how the ctypes
module works, but it's a fairly simple amount of code in assembly to push
characters into the keyboard buffer. I presume there may be some builtins in
C that would allow you to do the same thing.

Of course the real issue is making sure that the FORTRAN program actually is
the program reading the buffer, which is probably the problem with your
python program. I don't know if it makes a difference, but I know in
assembly you can use an interrupt to read a character from stdin *or* you
can use an interrupt to read a character from the keyboard buffer. If these
lower level calls are different enough (i.e. a MS interrupt to read from
stdin does some funky system-wide Windows stuff, and the keyboard call just
reads direct from the buffer - so it's lower level than stdin) then FORTRAN
might simply be reading straight from the buffer.

However, I don't quite have that much knowledge, although I could presumably
write up a few programs to test my theory, and if I have time today I'll
have to try that.

-Wayne


-- 
To be considered stupid and to be told so is more painful than being called
gluttonous, mendacious, violent, lascivious, lazy, cowardly: every weakness,
every vice, has found its defenders, its rhetoric, its ennoblement and
exaltation, but stupidity hasn’t. - Primo Levi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20090612/f2c633b3/attachment.htm>


More information about the Tutor mailing list