How to know if the mouse is in idle state
Hi Specialist:
In the app below, when the app is triggered, the figure is imported. But then the mouse is placed in any place of this window. How to set an idle event to know if it's in idle state. Thank you.
In the app below, when the app is triggered, the figure is imported. But then the mouse is placed in any place of this window. How to set an idle event to know if it's in idle state. Thank you.

Tagged:
Answers
It's not clear what are you trying to achieve, can you please provide more details what you are going to do?
The application is in an idle state as soon the function you invoked is completed, e.g. the app is loaded.
Yuri
Thanks for your answer, please let me clarify further. I would like to monitor the mouse event after the processing finished. Within the red frame, the mouse event can be found involving Mycontrol like the figure. However, when the mouse move outside of this red frame, the mouse event can not be monitored.
I would like to monitor the mouse (especially idle state) not only within red frame but also outside red frame. Could you please give some advice? Thank you.
So, you want to detect when the mouse is not moving anywhere on the screen, right? If yes, you can use a timer and periodically check the cursor position and detect when the position is not changing during some period. Similar problem is addresses in this post: https://stackoverflow.com/questions/609965/detecting-when-the-mouse-is-not-moving
Here is how you get cursor position in Image-Pro:
Yuri
Thanks for your direction. I tried to combine timer and cursor position. When the timer is triggered, the position can be exhibited, like below, but the effect is not good.
I tried to apply thread as well, but the easiest example program exists issue in AddressOf.
Please give some advice, thank you.
The idea is to start timer and monitor the displacement of the cursor between the ticks. I've attached the demo project that contains this code:
When the mouse stops or start moving again, the Output is updated.
Load the attached project and run StartMouseMonitoring macro.
Let me know if it works for you.
Yuri
Hi YuriG:
I try to make a interactive window like below to prompt user click OK or Cancel. And I hope to add your timer program to continue the program. It means after an idle time, the system will move ahead like the user click the OK. But I found the program seems to wait within the "With" block. Could you please give some advice? Thank you.
The interactive prompt can be stopped by assigning IsInteracting property of the command to False. The attached project shows how to do that and provides 3 ways of handling workflow: Ok, Cancel, Time Expired:
Yuri
Just an enquiry if it is possible to change the name of "OK" to "live preview"? Thank you.
You can hide Ok button in Automate.ScriptingCommands.Interaction using InteractionButtons=0. Also, this command has own Timeout property, so no need for own timer:
Using own buttons in interactive prompt is supported, but you have to create own command class and overwrite "ShowInteraction" function, which is not supported on macro level.
It might be easier to create a button in your app with text you want.
Yuri
Thanks for your kind answer. I have considered build an app to do interactive job but the effect is not good as I met some issues, it is better to use the one you recommended before. I will just write some more explanations in the interactive window. Thank you so much for solving this issue.