We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,420 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Fake User Program

I want to be able to make a program that emulates what a human at a computer can do. IE: I want to be able to read the visual information of a window (a 2d array of colour would be perfect) and be able to send virtual key syms and mouse movements to the window. Is this at all possible, and if so how is it done?

3
Contributors
9
Replies
2 Days
Discussion Span
8 Months Ago
Last Updated
10
Views
Question
Answered
Labdabeta
Practically a Master Poster
615 posts since Feb 2011
Reputation Points: 27
Solved Threads: 31
Skill Endorsements: 1

yes it is opossible, how to do it depends on the operating system. For MS-Windows you need to learn win32 api functions. Here is a good tutorial. After you have learned that you can start learning MS-Windows GDI functions

Ancient Dragon
Achieved Level 70
Team Colleague
32,157 posts since Aug 2005
Reputation Points: 5,836
Solved Threads: 2,577
Skill Endorsements: 69

I looked through that, and it seemed to have what I was looking for in terms of reading the info of the window (I can get its coordinates on the screen then use getPixel on the area?) but it had nothing on how to send fake input to a window. Perhaps the broken link contained the info?

Labdabeta
Practically a Master Poster
615 posts since Feb 2011
Reputation Points: 27
Solved Threads: 31
Skill Endorsements: 1

read this article for keyboard input

Ancient Dragon
Achieved Level 70
Team Colleague
32,157 posts since Aug 2005
Reputation Points: 5,836
Solved Threads: 2,577
Skill Endorsements: 69

That is great for keyboard input... but what about mouse... I have clarified in my mind what I want a little more now. I want the following self explanatory functions:

WINDOW_HANDLE_TYPE getWindowBasedOnTitle(const char *title);
COLOUR_TYPE **getWindowOutput(WINDOW_HANDLE_TYPE wnd);
void sendKeySym(char key, WINDOW_HANDLE_TYPE wnd);
void setMouseXY(int x, int y, WINDOW_HANDLE_TYPE wnd);
void simClick(bool left, WINDOW_HANDLE_TYPE wnd);
Labdabeta
Practically a Master Poster
615 posts since Feb 2011
Reputation Points: 27
Solved Threads: 31
Skill Endorsements: 1
  1. EnumWindows()

  2. See my previous post about gdi functions, especially BitBit()

Ancient Dragon
Achieved Level 70
Team Colleague
32,157 posts since Aug 2005
Reputation Points: 5,836
Solved Threads: 2,577
Skill Endorsements: 69

You may also want to have a look at AutoIt
It might save you the trouble of re-inventing the wheel if you dont need the gritty details.

L7Sqr
Practically a Posting Shark
851 posts since Feb 2011
Reputation Points: 253
Solved Threads: 155
Skill Endorsements: 7

Ok, I read the links and I understand how to identify a window and how to copy the output of its device context. What I still do not understand is how to send virtual keysyms/mouse clicks/mouse movements?

Labdabeta
Practically a Master Poster
615 posts since Feb 2011
Reputation Points: 27
Solved Threads: 31
Skill Endorsements: 1
Ancient Dragon
Achieved Level 70
Team Colleague
32,157 posts since Aug 2005
Reputation Points: 5,836
Solved Threads: 2,577
Skill Endorsements: 69

Perfect! :)

Labdabeta
Practically a Master Poster
615 posts since Feb 2011
Reputation Points: 27
Solved Threads: 31
Skill Endorsements: 1
Question Answered as of 8 Months Ago by Ancient Dragon and L7Sqr

This question has already been solved: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.0882 seconds using 2.7MB