Indigo Rose Software
  #1  
Old 11-09-2003
rhosk's Avatar
rhosk rhosk is offline
Indigo Rose Customer
 
Join Date: Aug 2003
Location: Maine, USA
Posts: 1,692
Sense Mouse Movement

Is there any way that AMS (5 or preferably 4 right now) can sense mouse movement? Similar to the way windows does like for a screensaver (to terminate it)? Got an interesting project in mind that would need to exit upon mouse movement or keypress. Thanks for any tips.
__________________
Regards,

-Ron

Music | Video | Pictures
Reply With Quote
  #2  
Old 11-09-2003
Corey's Avatar
Corey Corey is offline
Registered User
 
Join Date: Aug 2002
Posts: 9,746
Keypress isn't that hard to do, I think someone posted something about how to key hook using a .dll a while back. But that being said I bet someone here can figure out the mouse movement thing. It can't be that hard because you see it in lots of very simple apps... Cool idea, if someone can figure this out I would probably use it too...

Corey Milner
Creative Director, Indigo Rose Software
Reply With Quote
  #3  
Old 11-09-2003
rhosk's Avatar
rhosk rhosk is offline
Indigo Rose Customer
 
Join Date: Aug 2003
Location: Maine, USA
Posts: 1,692
I know I can figure out a "cheezy" way of doing it with Flash (onMouseMove), but I was hoping for a "global" movement on the screen. Flash will only do it if you broadcast over a MC/Button, etc. Conversely, you could make the clip transparent I guess, but you would still be at the mercy of the confines of the clip - not the whole computer screen.

Where's Worm when you need him, eh (when you get time )? It's probably some kind of dll function that can sense mouse movement; guessing & of course, hoping.
__________________
Regards,

-Ron

Music | Video | Pictures
Reply With Quote
  #4  
Old 11-11-2003
rhosk's Avatar
rhosk rhosk is offline
Indigo Rose Customer
 
Join Date: Aug 2003
Location: Maine, USA
Posts: 1,692
Maybe if I provide details on what I would like to accomplish here, it would possibly be worthwhile to look into? Still haven't figured out a way and would like some ideas. Anything would be great from any of you gurus!!

Would like to simply launch an AMS executable that would maybe reside in the system tray and be able to sense inactivity of the mouse/keyboard for a period of time (I can do the time part easy enough) - again similar (actually exactly) like a screensaver scenario. When this inactive time has elapsed, launch an external application. Conversely, when it senses mouse/key press activity, while this external app is running, AMS finds the window and closes it. I can figure out everything for this project except the mouse sensing. This poor sole would be willing to pay for a viable solution, it's that important. Thanks for reading!
__________________
Regards,

-Ron

Music | Video | Pictures
Reply With Quote
  #5  
Old 11-11-2003
Corey's Avatar
Corey Corey is offline
Registered User
 
Join Date: Aug 2002
Posts: 9,746
Well there may very well be a free solution yet I'm sure but just FYI our programmers can be had for a reasonable price and there's not too much they can't figure out.

If you look at the status bar in AMS 5.0 you can see that it is displaying your mouses co-ordinates in real time (I love the status bar in 5.0 A LOT) which is basically what you want to do but in your apps, i.e. a plug-in which adds mouse functions such as:

Mouse.X();
Mouse.Y();

And maybe even:

Mouse.Hide();
Mouse.Show();
Mouse.CursorAttach();
Mouse.CursorRemove();
Mouse.OnClick();

Just riffing. That would be cool, plus a plug-in like that would have lots of room for version expansion as you could add more and more complex things over time including right click menu controls, augmented events such as OnDrag/OnDrop, hit testing, etc.

Corey Milner
Creative Director, Indigo Rose Software
Reply With Quote
  #6  
Old 11-12-2003
rhosk's Avatar
rhosk rhosk is offline
Indigo Rose Customer
 
Join Date: Aug 2003
Location: Maine, USA
Posts: 1,692
I am still working this issue as this thread slowly but surely tries to disappear. Have I stumped everyone, haha, or does it sound like not such a good idea? As in most of my strange cases, I cannot find a solution to this problem (searched for a couple of days on the Net) and I really thought that 5.0 could be the answer, but I can't see how it could do it either. I did manage to figure out (on XP anyway) that "scrnsave.exe" in the system32 directory will launch an executable (even if you change the extension from exe to scr), and you can even select it in properties to set the delay, but I don't know how reliable this will be, and the executable in question is obviously missing some code to terminate the app on keypress or mousemove, so I'm still stuck.

I can't even find a program or a workaround for launching executables (as a quasi-screensaver) anywhere! They all boast to launch images, swf's and even videos, but just a mere program - I guess there's been no demand for this. I may have to live with "press any key" to terminate, but this seems to be a challenge as well. I've seen a couple examples on how to detect individual keys, but would there happen to be a blanket any key script? Or would I have to compile a large script to account for every key? Sorry to ramble.
__________________
Regards,

-Ron

Music | Video | Pictures
Reply With Quote
  #7  
Old 11-12-2003
TJ_Tigger's Avatar
TJ_Tigger TJ_Tigger is offline
Indigo Rose Customer
 
Join Date: Sep 2002
Location: Sol 3
Posts: 3,188
Isn't there a .dll that was used to set the visibility of the mouse pointer. Could you use that to sense mouse movement. You could use a timer and maybe get the mouse position and compare it with the last poll. Stir and repeat.


Declare Sub mouse_event Lib "user32" Alias "mouse_event" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)

· dwFlags
A set of flag bits that specify various aspects of mouse motion and button clicking. The bits in this parameter can be any reasonable combination of the following values:
MOUSEEVENTF_ABSOLUTE
Specifies that the dx and dy parameters contain normalized absolute coordinates. If not set, those parameters contain relative data: the change in position since the last reported position. This flag can be set, or not set, regardless of what kind of mouse or mouse-like device, if any, is connected to the system. For further information about relative mouse motion, see the following Remarks section.
MOUSEEVENTF_MOVE
Specifies that movement occurred.
MOUSEEVENTF_LEFTDOWN
Specifies that the left button changed to down.
MOUSEEVENTF_LEFTUP
Specifies that the left button changed to up.
MOUSEEVENTF_RIGHTDOWN
Specifies that the right button changed to down.
MOUSEEVENTF_RIGHTUP
Specifies that the right button changed to up.
MOUSEEVENTF_MIDDLEDOWN
Specifies that the middle button changed to down.
MOUSEEVENTF_MIDDLEUP
Specifies that the middle button changed to up.
MOUSEEVENTF_WHEEL
Windows NT only: Specifies that the wheel has been moved, if the mouse has a wheel. The amount of movement is given in dwData

The flag bits that specify mouse button status are set to indicate changes in status, not ongoing conditions. For example, if the left mouse button is pressed and held down, MOUSEEVENTF_LEFTDOWN is set when the left button is first pressed, but not for subsequent motions. Similarly, MOUSEEVENTF_LEFTUP is set only when the button is first released.

· dx
Specifies the mouse’s absolute position along the x-axis or its amount of motion since the last mouse event was generated, depending on the setting of MOUSEEVENTF_ABSOLUTE. Absolute data is given as the mouse’s actual x-coordinate; relative data is given as the number of mickeys moved. A mickey is the amount that a mouse has to move for it to report that it has moved.

· dy
Specifies the mouse’s absolute position along the y-axis or its amount of motion since the last mouse event was generated, depending on the setting of MOUSEEVENTF_ABSOLUTE. Absolute data is given as the mouse’s actual y-coordinate; relative data is given as the number of mickeys moved.

· dwData
If dwFlags is MOUSEEVENTF_WHEEL, then dwData specifies the amount of wheel movement. A positive value indicates that the wheel was rotated forward, away from the user; a negative value indicates that the wheel was rotated backward, toward the user. One wheel click is defined as WHEEL_DELTA, which is 120.
If dwFlags is not MOUSEEVENTF_WHEEL, then dwData should be zero.

· dwExtraInfo
Specifies an additional 32-bit value associated with the mouse event. An application calls GetMessageExtraInfo to obtain this extra information.

Last edited by TJ_Tigger; 11-12-2003 at 03:34 PM.
Reply With Quote
  #8  
Old 11-12-2003
rhosk's Avatar
rhosk rhosk is offline
Indigo Rose Customer
 
Join Date: Aug 2003
Location: Maine, USA
Posts: 1,692
Where it be (dll)?? Sounds as if that would be a good start! I'm desperate for any pointers right now (no pun intended).

That's actually how Flash does it, but the [window] needs focus to work. I mean, not even focus because it (cursor) has to actually be inside the movie (let's say - not a 1x1 pixel). I'd like this to work in a basic windows environment if at all possible.

OK tigger, that's not fair, you edited while I was typing
__________________
Regards,

-Ron

Music | Video | Pictures
Reply With Quote
  #9  
Old 11-12-2003
rhosk's Avatar
rhosk rhosk is offline
Indigo Rose Customer
 
Join Date: Aug 2003
Location: Maine, USA
Posts: 1,692
Um...Tigger, can you explain yer last post just a bit? I don't know where to start.
__________________
Regards,

-Ron

Music | Video | Pictures
Reply With Quote
  #10  
Old 11-12-2003
Corey's Avatar
Corey Corey is offline
Registered User
 
Join Date: Aug 2002
Posts: 9,746
Cool Tigg!

Corey Milner
Creative Director, Indigo Rose Software
Reply With Quote
  #11  
Old 11-12-2003
TJ_Tigger's Avatar
TJ_Tigger TJ_Tigger is offline
Indigo Rose Customer
 
Join Date: Sep 2002
Location: Sol 3
Posts: 3,188
Quote:
Originally posted by rhosk
Um...Tigger, can you explain yer last post just a bit? I don't know where to start.
Me neither. But I was looking around on one of the dll boards that Worm mentions and thought it might be a good place to start. It looks like User32.dll has a library with an alias of mouse_event where one might be able to determine if there has been mouse movement by using an 'event' called MOUSEEVENTF_MOVE. But I don't know how to proceed from here. I will play around and see what I can do.

Again, I think you could put this on a timer and have it fire every 60 seconds if you wanted to see if there was mouse movement.
Reply With Quote
  #12  
Old 11-12-2003
rhosk's Avatar
rhosk rhosk is offline
Indigo Rose Customer
 
Join Date: Aug 2003
Location: Maine, USA
Posts: 1,692
I sorta get the gist, but still don't know where to start :confused:

Where in the heck is Worm!? Haven't seen him around the boards lately. I will play with this tomorrow and see if I can make it do something. It definitely sounds like the right track. Thanks again!
__________________
Regards,

-Ron

Music | Video | Pictures
Reply With Quote
  #13  
Old 11-12-2003
Corey's Avatar
Corey Corey is offline
Registered User
 
Join Date: Aug 2002
Posts: 9,746
I'm probably wrong but I think MOUSEEVENTF_MOVE is used to create mouse movement, not detect it... BTW one super easy way if you are in a rush is to use this and serve your content via kiosk mode browser. http://www.scriptsearch.com/cgi-bin/jump.cgi?ID=1274 A cheap workaround I know but it's fast. I'll take a look around and see if I can find any better ideas...

FYI I think getting GetCursorPos from user32.dll is the thing. You can set it on a one second timer to look for any change in that value...

Corey Milner
Creative Director, Indigo Rose Software
Reply With Quote
  #14  
Old 11-13-2003
Worm Worm is offline
Indigo Rose Customer
 
Join Date: Jul 2002
Location: USA
Posts: 3,937
Corey's right, the best bet would be to use GetCursorPos in a timer (use a silent MP3 in 4). Problem is that its not directly callable from AMS because of the way the data is returned. I'll see if I can throw together a wrapper DLL to return the data in a meaningful way. When I do, don't forget to use some sort of tolerance in checking the position. The slightest mouse movement will change the X,Y position.
Reply With Quote
  #15  
Old 11-13-2003
Corey's Avatar
Corey Corey is offline
Registered User
 
Join Date: Aug 2002
Posts: 9,746
This is the 5.0 forum so page timers are available. The moribundly silent MP3 rides no more.

Corey Milner
Creative Director, Indigo Rose Software
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT -6. The time now is 03:15 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Copyright © 2000 - 2009 Indigo Rose Corporation. All rights reserved.
Indigo Rose Software