By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,766 Members | 1,427 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,766 IT Pros & Developers. It's quick & easy.

imitating user input

P: n/a
I need to imitate keyboard strokes in an active window inside of
internet explorer, specifically I need my program to log on to a
chatroom without me actually sitting in front of my computer. Also,
once it has logged on to the program I need my program to "read"
(search for strings, etc.) the text that's entered by other users in
this "chatroom". The problem I have is actually logging in to the
chatroom since I have not found a way to duplicate keyboard strokes.
If someone could point me in the right direction on tutorials about
this or show me a sample program that does this I would really
appreciate it.
--grigri9

P.S. I am a first semester programming student at my high school and
Python is the only language I know.
Jul 18 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a

"Greg Grin" <gr*****@yahoo.com> wrote in message
news:eb**************************@posting.google.c om...
I need to imitate keyboard strokes in an active window inside of
internet explorer, specifically I need my program to log on to a
chatroom without me actually sitting in front of my computer. Also,
once it has logged on to the program I need my program to "read"
(search for strings, etc.) the text that's entered by other users in
this "chatroom". The problem I have is actually logging in to the
chatroom since I have not found a way to duplicate keyboard strokes.


For this problem, you do *not* need to imitate keystrokes (and mouseclicks)
in the way that you would for interacting with a local interactive program.
You *do* need to send and receive strings through internet sockets
according to the Internet Relay Chat protocol (assuming that that is the
protocol used by the site you are interested in. There are existing chat
programs that can be scripted in Python. The Python-coded Twisted package
also includes an IRC implementation. Some of the other internet packages
may also.

Look at
http://twistedmatrix.com/users/jh/te...ocols.irc.html
or google Python Internet Relay Chat protocol, as I did, for more.

Terry J. Reedy


Jul 18 '05 #2

P: n/a
Hello Greg,
I need to imitate keyboard strokes in an active window inside of
internet explorer, specifically I need my program to log on to a
chatroom without me actually sitting in front of my computer. Also,
once it has logged on to the program I need my program to "read"
(search for strings, etc.) the text that's entered by other users in
this "chatroom". The problem I have is actually logging in to the
chatroom since I have not found a way to duplicate keyboard strokes.

I agree with the other response, however if you're interested in
generating key strokes anyhow have a look at AutoIt
(http://www.hiddensoft.com/AutoIt/). You can use either the executable
by generating scripts or the ActiveX component (or even the dll with
ctypes).

HTH.
Miki
Jul 18 '05 #3

P: n/a
Try This:

Rob Marchetti: Pamie [Pamie allows you to write Python scripts in
order to drive Internet Explorer. Pamie is a lite Python port of SAMIE
written in Perl by Henry Wasserman. This is a "free" open-source tool
written for QA engineers or developers as a means to simulate users
exploring a web site. ]

http://pamie.sourceforge.net/
Jul 18 '05 #4

P: n/a
Greg,

There are lots of ways to do this. Pamie is just one method.
basically you want to set the value of a two textboxes and submit the
form.

If you have an instance of the browse you can access it's methods and
attributes.

In Python you could do it this way:

#Instantiate a new instance of the IE browser:
ieBrowser = DispatchEx('InternetExplorer.Application')

Now you have access to the textboxes and it's buttons
Since you have and instance of the browser ieBrowser you can begin:

For example a simple login page with username textbox, password
textbox and submit button.

ieBrowser.Document.forms[0].elements.all[username].value =
"YourUsername"
ieBrowser.Document.forms[0].elements.all[password ].value =
"YourPassword"
ieBrowser.Document.forms[0].elements.all[SubmitButtonName].form.submit()

You can get the actual names for your username, password and
SubmitButtonName from viewing the source of the Webpage and doing a
find on the word "input"

You can do the above in Perl VB ruby etc.. although the syntax may be
a little different.

Hope this helps.

Enjoy

RLM
Pamie creator


For more information:
http://msdn.microsoft.com/library/de...ence_entry.asp
Jul 18 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.