Source language: Translate to:

SetMousePos

Questions about using NeoBook's scripting language

Moderator: Neosoft Support

SetMousePos

Postby Alex » Sat Oct 07, 2006 10:48 am

Hello,
There is a thing which I do not manage to make, it is that as soon as there is no movement at the end of 30 min, the mouse puts itself at this position: SetMousePos “359” “223” I do not know how I must write the code.

Thank you

Alex
Alex
 
Posts: 745
Joined: Sat Mar 04, 2006 4:53 am

Postby Gaev » Sat Oct 07, 2006 12:05 pm

Alex:
... as soon as there is no movement at the end of 30 min, the mouse puts itself at this position: SetMousePos “359” “223”
... you will need to use a Timer Object ... I am assuming you are only interested in ensuring that the mouse pointer was at the same position at time t and t+30 minutes ... set the Timer Interval to 1800000 (i.e. 30 times 60 times 1000 milliseconds) ... and Check to "Stop Timer after one execution"

Before you start the Timer ...
Code: Select all
GetMousePos "[BeginMouseX]" "[BeginMouseY]"
... then, in your Timer Interval section, you can do ...
Code: Select all
GetMousePos "[NowMouseX]" "[NowMouseY]"
If "[BeginMouseX],[BeginMouseY]" "<>" "[NowMouseX],[NowMouseY]"
   SetMousePos “359” “223”
EndIf


However, if you want to make sure that the mouse pointer also remains in the EXACT same position during this period, then set the TimerInterval to (about) 1000 or 2000 (1 second or 2 seconds) .... and the TimerInterval section will be somewhat different ... depending on what you want done as soon as the mouse is moved.
User avatar
Gaev
 
Posts: 3738
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Postby Alex » Sat Oct 07, 2006 11:26 pm

Hi

Code: Select all
GetMousePos "[BeginMouseX]" "[BeginMouseY]"

Where must I write this ???

then, in your Timer Interval section, you can do ...
Code: Select all
GetMousePos "[NowMouseX]" "[NowMouseY]"
If "[BeginMouseX],[BeginMouseY]" "<>" "[NowMouseX],[NowMouseY]"
   SetMousePos “359” “223”
EndIf



And why must I Check to "Stop Timer after one execution" ???

I don't understand


Thanks


Alex
Alex
 
Posts: 745
Joined: Sat Mar 04, 2006 4:53 am

Postby Gaev » Sun Oct 08, 2006 5:32 am

Alex:
Where must I write this ???
And why must I Check to "Stop Timer after one execution" ???

The answers to these questions depend on the design of your application ... I can't tell from your brief description of the function you wanted, how/where you are going to apply this within your application.

The general idea is that ...

a) at the start of the period when you begin to check for mouse movement, you save the mouse positions in variables

b) at the end of the 30 minutes, you compare the new/current mouse positions against the previously saved mouse positions to see if there is any change


If you want to start checking this as soon as your application starts, then place the first command in the "StartUp" section of NeoBook ... and also start the timer at the same time.

If you want to check this more than once (e.g. as long as your application is running), do NOT have the timer stop after one execution ... however, you would also have to make sure (within the Timer Interval section) that if the mouse position has changed, you save the new mouse position ... so you can compare this new position against the one at the end of the next timer interval.
User avatar
Gaev
 
Posts: 3738
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Postby Alex » Sun Oct 08, 2006 7:57 am

Thanks
Alex
 
Posts: 745
Joined: Sat Mar 04, 2006 4:53 am


Return to NeoBook Action Commands

Who is online

Users browsing this forum: No registered users and 1 guest