Click and hold LMB
-
Hi,
In what context ?
-
Yes it is. Do you need to do that for testing purpose ? Is it for automation ? Are you doing targeting your own application ? Another one ?
-
@rktech
So you try to do that to OTHER application correct ?so while you can do that internal in Qt app like
QMouseEvent *mEvnPress = new QMouseEvent(QEvent::MouseButtonPress, QPoint(10, 10), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier); QMouseEvent *mEvnRelease = new QMouseEvent(QEvent::MouseButtonRelease, QPoint(10, 10), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier); QCoreApplication::sendEvent(pWidget, mEvnPress); QTimer::singleShot( 5000, [pWidget, mEvnRelease]() { QCoreApplication::sendEvent(pWidget, mEvnRelease); });
It wont work for outside.
You must use native OS calls to do that.
Is this on windows only ?
or you need to work on linux / macos too ? -
-
Hi
You have to use native API
https://stackoverflow.com/questions/7492529/how-to-simulate-a-mouse-movementI would check first with autoit3
https://www.autoitscript.com/site/
if it cant click on your game, you wont be able too either. -
I've never heard that AI or bots in games need to take control of keyboard or mouse... In most cases, you can bypass it and make direct inputs...
What should your 5s-click trigger? What do you want to achieve?EDIT:
Is it for a bot in your game or 3rd party software and you want to write a bot in Qt? (my suggestion above only works, if you have full access to the code, which isn't the case when you are not using your own game...)
-
@Pl45m4 said in Click and hold LMB:
I've never heard that AI or bots in games need to take control of keyboard or mouse... In most cases, you can bypass it and make direct inputs...
What should your 5s-click trigger? What do you want to achieve?EDIT:
Is it for a bot in your game or 3rd party software and you want to write a bot in Qt? (my suggestion above only works, if you have full access to the code, which isn't the case when you are not using your own game...)
Of course it's not my own game.
-
@mrjj said in Click and hold LMB:
@rktech
So you try to do that to OTHER application correct ?so while you can do that internal in Qt app like
QMouseEvent *mEvnPress = new QMouseEvent(QEvent::MouseButtonPress, QPoint(10, 10), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier); QMouseEvent *mEvnRelease = new QMouseEvent(QEvent::MouseButtonRelease, QPoint(10, 10), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier); QCoreApplication::sendEvent(pWidget, mEvnPress); QTimer::singleShot( 5000, [pWidget, mEvnRelease]() { QCoreApplication::sendEvent(pWidget, mEvnRelease); });
It wont work for outside.
You must use native OS calls to do that.
Is this on windows only ?
or you need to work on linux / macos too ?use of undeclared identifier 'pWidget'
-
@rktech said in Click and hold LMB:
It is not a requirement, but I want some high-level language.
I have used that python library I pointed to you. I have automated games at home and applications at work with that library. It has functions to find the process, interface to widgets if available, it also has raw clicks based upon position. It already has all the function calls figured out for the windows platform. It is also extremely easy to use compared to a C++ solution. You most likely will not find a widget set in a game. Since they are rendering to opengl or directx. So raw clicks is your best bet.
If you pursue a C++ solution you will have to either find an automation library or dig through the windows api to find the calls to do click events or key events.
You could create a python based qt application and use that automation library for the backend portion of the app.
-
@rktech said in Click and hold LMB:
@fcarney The problem is, that I don't know Python.
It's maybe a good time to learn :-)