Jump to content

Mouse movement from script


Recommended Posts

Does the mouse movement while a script runs overide a user on the pc?

I am using AutoIt to send mouse clicks to another application from Excel and I am wondering if those commands will work if I am using the mouse/keyboard when the script fires. If not, is there a way to run those commands in the background (i.e. a mouse click at a certain coordinate without actually moving the pointer on the screen)? I don't want to interfere with the script, but at the same time, I never know when the script will run, so I can't know when to NOT use the mouse).

Thanks

Link to comment
Share on other sites

Does the mouse movement while a script runs overide a user on the pc?

I am using AutoIt to send mouse clicks to another application from Excel and I am wondering if those commands will work if I am using the mouse/keyboard when the script fires. If not, is there a way to run those commands in the background (i.e. a mouse click at a certain coordinate without actually moving the pointer on the screen)? I don't want to interfere with the script, but at the same time, I never know when the script will run, so I can't know when to NOT use the mouse).

Thanks

the program will continue to click etc at the assigned location on which ever window is on top, even if, as a user, you click on some other window you got open and give it the focus. the clicks will continue in whichever window has the focus

i cannot give help as to the minimized clicking or w/e it is you need but i nkow its possible.. its just wether it works on A:I or not that baffles me

~Sarc

edit: sorry that came out wrong first time round

Edited by Sarc
Link to comment
Share on other sites

Does the mouse movement while a script runs overide a user on the pc?

I would not say that one overrides the other. I would say that a user can interfere with the mouse movements that a script is attempting to achieve and that a script can interfere with the mouse movements that a user is attempting to achieve.

If not, is there a way to run those commands in the background (i.e. a mouse click at a certain coordinate without actually moving the pointer on the screen)?

ControlClick might do what you want, however there are at least two other options:

1) You might be able do all that you need using COM. It can interact with Excel (and other apps) without a window showing.... but it is not something that I would suggest to a new user.

2) Add a msgbox to your existing script asking if it is alright to run the script. Have the msgbox timeout incase there is no one at the keyboard when it comes up.

the program will continue to click etc at the assigned location on which ever window is on top...

Not if the script is written carefully. Never send a click without checking (or activating) the window of interest. Edited by herewasplato

[size="1"][font="Arial"].[u].[/u][/font][/size]

Link to comment
Share on other sites

Does the mouse movement while a script runs overide a user on the pc?

I am using AutoIt to send mouse clicks to another application from Excel and I am wondering if those commands will work if I am using the mouse/keyboard when the script fires. If not, is there a way to run those commands in the background (i.e. a mouse click at a certain coordinate without actually moving the pointer on the screen)? I don't want to interfere with the script, but at the same time, I never know when the script will run, so I can't know when to NOT use the mouse).

Thanks

a user can fight with mousemove(), unless you use blockinput() to tie their hands first :P just a note if you're going to go that way though, make sure you reset w/ blockinput(0) when they can use the mouse again, also if your script locks up because of a wait condition that's never met, input will stay blocked. You can press control alt delete to set blockinput(0) if the script is hung and input is blocked. if you need a location clicked though, use either mouseclick() (with explicit coordinates) or controlclick() if you're clicking on a standard MS control. controlclick can click in non active windows, but mouseclick() just clicks in a specific location, regardless of what window is there.
Link to comment
Share on other sites

ControlClick might do what you want

If I understand it correctly, ControlClick allows you to focus on a button or whatever control and click on it, correct? My problem is that I am interacting with a Java application that does not allow focus of the button I need to press. (I trade currencies and I am trying to automate certain actions with the broker's order entry application, and for some reason they do not offer a hotkey to submit a trade, rather I must press the submit button). Since its not a windows based app, the standard control functions are not available to me (to my knowledge).

1) You might be able do all that you need using COM. It can interact with Excel (and other apps) without a window showing.... but it is not something that I would suggest to a new user.

I am using the COM from VBA within excel. But when I call a mouseclick, you can still see the pointer move to the window and click. If there is a way to do this without it showing on the screen then that would be awesome.

I did not notice the BlockInput function, that may be what I need to use. I don't mind if the script overides what I am doing when it fires, since its only for a couple of seconds and doesn't occur very often.

Thanks for the help everyone. I appreciate any and all suggestions.

Link to comment
Share on other sites

If I understand it correctly, ControlClick allows you to focus on a button or whatever control and click on it, correct? My problem is that I am interacting with a Java application that does not allow focus of the button I need to press. (I trade currencies and I am trying to automate certain actions with the broker's order entry application, and for some reason they do not offer a hotkey to submit a trade, rather I must press the submit button). Since its not a windows based app, the standard control functions are not available to me (to my knowledge).

I am using the COM from VBA within excel. But when I call a mouseclick, you can still see the pointer move to the window and click. If there is a way to do this without it showing on the screen then that would be awesome.

I did not notice the BlockInput function, that may be what I need to use. I don't mind if the script overides what I am doing when it fires, since its only for a couple of seconds and doesn't occur very often.

Thanks for the help everyone. I appreciate any and all suggestions.

one thing that i suggest to everyone forced to interact with an applet is to get a decompiler (i personally use the DJ Java Decompiler freeware that i downloaded a few years ago off of cnet or download.com). With it you can get into the applet, and see exactly what it's doing, and quite possibly eliminate the need for the applet at all. I mean if you know what data the applet is using, and exactly what it's doing with the data, as far as where it's being sent, etc, there is no reason that you cannot re-create the exact same functionality with your own gui. Assuming you are allowed to reverse engineer the applet (or don't care) it usually doesn't take too long to convert code from one language to another, and alot of times java developers don't even obfuscate their code because they assume that once it's in byte code it's immune to tampering.
Link to comment
Share on other sites

If I understand it correctly, ControlClick allows you to focus on a button or whatever control and click on it, correct? My problem is that I am interacting with a Java application that does not allow focus of the button I need to press. (I trade currencies and I am trying to automate certain actions with the broker's order entry application, and for some reason they do not offer a hotkey to submit a trade, rather I must press the submit button). Since its not a windows based app, the standard control functions are not available to me (to my knowledge).

Sounds like you understand it right. ControlClick probably will not work for that app.

I am using the COM from VBA within excel. But when I call a mouseclick, you can still see the pointer move to the window and click. If there is a way to do this without it showing on the screen then that would be awesome.

From what I've read, you should be able to do most things within Excel without an Excel window showing (and no mouse moves needed).

Search the forum for:

+COM +Excel

and you should get a few hundred returns...

Here is a brief two:

http://www.autoitscript.com/forum/index.ph...83entry132083

http://www.autoitscript.com/forum/index.ph...169entry76169

Or limit the search to:

+COM +Excel +invisible

BTW, welcome to the forums!

[size="1"][font="Arial"].[u].[/u][/font][/size]

Link to comment
Share on other sites

Thanks for the links, I will read through those threads. I am ok with Excel being visible, but what I would like is to have the mouse clicks in the java app to be invisible (or at least done where I can't interfere with it when its firing the macro). I am reworking some code and plan to test the BlockInput function.

BTW, welcome to the forums!

Thank you! Everyone has been very helpful here.

Regards

Link to comment
Share on other sites

Thanks for the links, I will read through those threads. I am ok with Excel being visible, but what I would like is to have the mouse clicks in the java app to be invisible (or at least done where I can't interfere with it when its firing the macro). I am reworking some code and plan to test the BlockInput function.

Thank you! Everyone has been very helpful here.

Regards

if you can PM me the java applet, i should be able to create a gui with standard controls that does the same thing, that way you can utilize the controlclick and controlsend functions to reduce the chances of human error.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...