View Full Version : Query Mouse Location
_stev_ 08-30-2006, 05:46 AM Hello,
I have built a built a window and I want it to appear right at the mouse's current location, so is there a way to query the current position of the mouse when a script is run?
Thanks,
Stev
|
|
Andimation
08-30-2006, 08:09 AM
autoPlace -useMouse;
That will give you the position of the mouse within a panel. Not sure if that helps. Im not sure what units that returns either.
Andy
butCherHeLL
08-30-2006, 08:57 AM
here is my code it takes cursor position widely to screen
#include <maya/MSimple.h>
#include <maya/MGlobal.h>
#include <iostream>
#include <fstream>
using namespace std;
DeclareSimpleCommand(getcurPos, "Alias", "7.0");
MStatus getcurPos::doIt( const MArgList& )
{
MStatus stat ;WINSTA_READATTRIBUTES ;
LPPOINT lpoint=new tagPOINT;
::GetCursorPos(lpoint);
clearResult();
appendToResult(lpoint->x);
appendToResult(lpoint->y);
return MS::kSuccess;
}
howto use.:getcurpos turns 2 result
int $CurPos[]=`getcurPos`;
int $X=$CurPos[0];
int $Y=$CurPos[1];
in last year I had compiled it for my mel script list'n'click
HERE IS COMPILED PLUGIN
http://www.ddmel.com/miscfiles/getcurpos.mll
:thumbsup:
_stev_
08-30-2006, 06:11 PM
Thanks guys,
I'm going to try out both of these. Thanks!
Stev
_stev_
09-02-2006, 11:59 PM
Andy: I tried out that autoPlace command. It actually returns a point in 3d space. I need the actual screen coordinates of the mouse.
butcherhell: I checked out the plugin, but it wouldn't load. I'm using Maya 7.
Thanks for the suggestions guys. Any more ideas??
Stev
butCherHeLL
09-03-2006, 06:06 PM
but it wouldn't load. I'm using Maya 7.
no you are wrong.
I downloaded same mll in same link now.
tried in maya7 and maya7.0.1 Now. everything okay.
dont wait a UI window incoming after you load. :)
it is just integrates to enable a function to maya
----------------------------------------------------
by incoming result <1> will return when you load plugin into maya.
you will see this in script editor results side or bottom of maya
1 means it succesfully installed
than use it.
but dont wait a gorgeous shades or windowses incoming to show itself to see you to make you happy
it is just a function
waits to be used.
with a simple line.
butCherHeLL
09-03-2006, 06:13 PM
it maybe more clear to understand howto use. (it is maya 7.0.1).
I downloaded in same place.
I loaded same mll
I used function to get results of wide screen coordinates in an integer array.
(may be you need more mel learning.)
and I gave the source of mll .and maybe you may compile it for maya 8. also
http://img353.imageshack.us/img353/1793/untitledpf4.png
butCherHeLL
09-03-2006, 06:29 PM
butcherhell: I checked out the plugin, but it wouldn't load. I'm using Maya 7.
any thanks to me ?
or please send a screenshot that shows the error while loading mll plugin into maya please
butCherHeLL
09-03-2006, 06:33 PM
did you tried this plugin after 4-5 days after get a implict help ?
are you sure you really tried ?
-------------------------------
simple usage after load plugin
int $CurPos[]=`getcurPos`;
int $X=$CurPos[0];
int $Y=$CurPos[1];
X and Y are the refers the screenwide mouse coordinates
_stev_
09-04-2006, 01:18 AM
This is what I get in the Script Editor when I load the plugin:
// Error: line 1: Unable to dynamically load : C:/Program Files/Alias/Maya7.0/bin/plug-ins/getcurpos.mll
The specified module could not be found.
//
// Error: line 1: The operation completed successfully.
//
// Error: line 1: The operation completed successfully.
(getcurpos) //
I'm using Maya 7.0
Thanks for your help.
Stev
butCherHeLL
09-04-2006, 01:25 AM
I believe that you need to update XP SP2
it seems an OS problem.
or install DOT.NET
I think it needs a latest that sp2 uses.
somesays msvc71.dll or dont remember what it needs... I am looking for it.
but sure that if you upgrade to sp2 that problem shall gone.
okay. let me look which dll OS needs.
butCherHeLL
09-04-2006, 01:28 AM
this dll requires these files in system (commonly called system32 directory)
msvcr80.dll
kernel32.dll
user32.dll
foundation.dll
openmaya.dll
_stev_
09-04-2006, 01:35 AM
I believe that you need to update XP SP2
Yeah, I'm actually still running Windows 2000.
Thanks again,
Stev
butCherHeLL
09-04-2006, 01:39 AM
now maybe it is time to update ;)
CGTalk Moderation
09-04-2006, 01:39 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.