473,811 Members | 2,749 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

X11 & mouse emuloation

is it possible thru some libraries to move the mouse cursor under X11
from a C++ program and to call "click" ?

if anyone has a good link to a lib desc or anything, all help is welcome.

[trying to create a bot that would emulate user behaviour on a website
randomly clicking around and doing stuff like that.]

Jul 22 '05 #1
2 2600
Martin Roos wrote:

is it possible thru some libraries to move the mouse cursor under X11
from a C++ program and to call "click" ?


Could be that this is possible.
But you have to ask the experts for X11 on how to do it.
This group deals with Standard C++ only. Standard C++ doesn't have
a screen or a mouse or X11 or something like that.

--
Karl Heinz Buchegger
kb******@gascad .at
Jul 22 '05 #2
> Could be that this is possible.
But you have to ask the experts for X11 on how to do it.
This group deals with Standard C++ only. Standard C++ doesn't have
a screen or a mouse or X11 or something like that.


I will say it would bee better to ask this in comp.os.linux.x but
I do happen to know.

I am writing a class to do just this it is already capable of all
the things you want to do. I have two even. One uses the XTrap
extention the other uses XTest. I can email you the source code if
you want it. The code can also record input to a macro language.

To use the XTrap class you must have the line 'Load "xtrap"' in
the module section of your XF86Config-4 file and have the extention
compiled and installed. It comes with XFree86 and is compiled if
it is not disabled.

here is example code for using the class:

#include "send_event2.hh "

int main() {
X11_Send_Events hi;
hi.set_window(" Mozilla Firebird"); // Sets the Curent window to the a window matching
// string. Returns zero on fail.
hi.set_default_ window_position (0, 24); // exactly what it says... :-) X, Y.
hi.window_to_fr ont(); // Brings the window to the front and to the default
sleep(1); // position.
hi.button_toggl e(3); // Toggles the mouse button of choise 1-5.
sleep(1);
hi.button_toggl e(3);
sleep(1);
hi.button_click (1); // Clicks the mouse button of choise 1-5.
sleep(1);
hi.move_mouse(1 00, 200); // Move mouse x and y pixels.
sleep(1);
hi.move_mouse_a bsolute_window( 200, 35); // Move mouse to asolute position from corner of
sleep(1); // selected window. Uses top left corner.
hi.move_mouse_a bsolute_screen( 400, 300); // Move mouse to absolute postion from top left
sleep(1); // corner of screen.
hi.center_mouse _pointer_in_win dow(); // Centers the mouse pointer in the current window.
sleep(1);
hi.record_input _to_ostream (std::fstream*) ;// You must send the program a signal to get it
// to exit from this loop.
return 0;
}
--
Want to email me? remove both dashes from the email address.
Jul 22 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1421
by: prasat | last post by:
Hi Does anybody work with mouse package for cfd analysis in c++. I would like to decide issues. Please reply --
7
2000
by: Pete | last post by:
I'm working (playing) on a mouse following script. Yes, the sort no one likes but I'm having great fun tinkering with it - sad. Anyway, if there's enough page content to cause scrolling and I want the objects (colored divs) to scroll with the mouse in Opera 6. I give the mouse y coords (-) window.pageYOffset and the objects (+) window.pageYOffset. However, in Opera 7 it doesn't work. Only the following objects need (+)...
1
3797
by: Zaidan | last post by:
I am running Excel2000 under WIN98 2nd edition, and I am writing a VBA code (I will consider using javascript if I have to) that does the following, at the user command: 1- Start MS Explorer and go to my website. Login (enter ID and Password) 2- It will go and update some prices of some products that I sell 3- It will add new products or cancel some product I already have someone who wrote me in JavaScript a web form (no documentation...
1
2088
by: Alexandre Jaquet | last post by:
Hi, I would like to copy and paste a selected item on a web page I already 've a context menu when the user rigth click on an item. I would like to draw a rectangle who carry about current mouse position until the user click left to a position. I know how to draw a rectangle and how to get mouse position, now I need to know how can I draw the rectangle (move it with mouse coordinate)
8
2787
by: Tom | last post by:
Hi I am having problems working out if the mouse pointer is within the control bounds within the OnMouseMove method: Protected Overrides Sub OnMouseMove(ByVal e As MouseEventArgs) Debug.WriteLine(Me.Bounds.Contains(e.X, e.Y)) End Sub
1
5380
by: Sim | last post by:
Hello NG, I try to use drag and drop function between two list views. For this I found following code: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vstechart/html/vbtchimpdragdrop.asp It works fine, but I have another problem. I want to create functionality like a Windows Explorer. This means, if I select some items from list view No 1 and drag&drop this to the list view No 2, then I want to mark automatically
5
13817
by: Romulo NF | last post by:
Greetings, I´m back here to show the new version of the drag & drop table columns (original script ). I´ve found some issues with the old script, specially when trying to use 2 tables with drag&drop on the same page (which was not possible). Now i´ve a new concept of the script, more object oriented. I´ve also commented the whole code so you guys can easier understand it engine. What exactly we need when trying to make a column drag &...
5
4853
by: Zaxxon21 | last post by:
I'm basically trying to implement a simple drop down menu list for a button that I have. When the user hovers over the button, I want a list of button options to appear below the button. If the users mouse leaves the button, or the buttons in the list I want the list to disappear. I originally tried to place all of the drop down buttons into a single user control, and to then have them appear when users enter some button and disappear when...
0
5015
by: kronus | last post by:
Hi everyone, Yes, I need to use you guys as a sounding board once more :-) I have a button that has two listeners one for mouse up and the other for mouse down and they point to the same function. $btnRewind.addEventListener(MouseEvent.MOUSE_DOWN,onBtnBack); $btnRewind.addEventListener(MouseEvent.MOUSE_UP,onBtnBack);
0
9605
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10386
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10398
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10133
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7669
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5692
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4339
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3865
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3017
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.