getting mouse position relative to entire desktop

I've been trying to get the mouse position relative to the entire desktop, but neither of my clumsy attempts work - what am I doing wrong?

	var MouseXPos = desklet.ConvertToValue("%MOUSEX%");
var MouseYPos = desklet.ConvertToValue("%MOUSEY%");
alert(MouseXPos + "n" + MouseYPos)

apparently, this just returns the position relative to the desklet

	var MouseXPos = desklet.UI.Desktop.x
var MouseYPos = desklet.UI.Desktop.y

var MouseXPos = desklet.UI.Desktop.screenX
var MouseYPos = desklet.UI.Desktop.screenY

both of the above return undefined

#443782

I'm not sure where you got the idea for Desktop.X/y or ScreenX I didn't see it in my sdk so it makes sense it returns undefined.

I don't have a function that returns the X,Y of the mouse relative to the desktop. Sorry didn't think of that one.

BUT you can still get it if you get the MOUSE relative to the desklet then add the position of the desklet to those values

MouseX = desklet.GetMouseXPos + desklet.DeskletXPos;

MouseY = desklet.GetMouseYPos + desklet.DeskletYPos;

I think this would give you what you want

#443907

Haha, thank you pcm. I could have thought of that :)

I'm quite a noob when it comes to Javscript, so I googled for anything related to javascript and mouse positions - that's what I came up with. It seems this only works inside a browser.

As a sidenote: Is there a documentation on functions or methods that AveScripter does support, but that are not special AveScripter funtions or methods?

Or to rephrase the question, what javascript methods does AveScripter support, that are not listed in your SDK?

#443909

Avescripter uses the Microsoft scripting engine, so it support everything that is in that engine.

You can go here for more info:

http://msdn2.microsoft.com/en-us/library/ms950396.aspx

#443920

i tried to implement it like this:

function onClick()

{

var MouseXPos = desklet.GetMouseXPos + desklet.DeskletXPos;

var MouseYPos = desklet.GetMouseYPos + desklet.DeskletYPos;

this.layers('pos').text = MouseXPos + "n" + MouseYPos;

}

but AveScripter yields:

438  Runtime Error in Microsoft JScript

This Object does not support this property or method. Line:4 Column:1

thanks for the link and clarification :)

#443929

Sorry, I gave you code in VB. Its should be

var MouseXPos = desklet.GetMouseXPos() + desklet.DeskletXPos;

var MouseYPos = desklet.GetMouseYPos() + desklet.DeskletYPos;

this.layers('pos').text = MouseXPos + "n" + MouseYPos;

GetMouse is a Method where as DeskletXPos isn't

If your wondering why I did that, so am I. :S

#444055

thankyou, sir - seems to work well.

//Edit: No, it doesn't... its buggy somehow, gah. Would it be too difficult to add something like:

value = desklet.UI.desktop.mousex

value = desklet.UI.desktop.mousey

i'm planning on creating a radial menu via avescripter, since I don't know jack about LayeredWindows and such. maybe it will work out :)

#444711

It wouldn't be to difficult, but I have no time till end of April. Overtime at work is taking most of my time right now.

What seems buggy about it?

What are you trying to do? Move a desklets to your mouse position?

#444807

thanks for considering to add mouseposition functionality :)

It seems to only correctly update the mouseposition when a layer is at least clicked

getting the position via a hotkey gives false results, which are checked using a desktop measure tool.

and yes, i tried to hit a hotkey, say ctrl+space, to let a desklet show up at mouseposition:

var Visible = 1;

function ToggleShowDesklet()
{
if (Visible == 1)
{
DeskletFadeout(false,500)
Visible = 0;
}
else if (Visible == 0)
{
var MouseXPos = desklet.GetMouseXPos() + desklet.DeskletXPos;
var MouseYPos = desklet.GetMouseYPos() + desklet.DeskletYPos;
alert(MouseXPos + "," + MouseYPos)
// desklet.SetXYPos(MouseXPos,MouseYPos)
Visible = 1;
DeskletFadeIn(false,500)
}
}

#444831

Ya.. the GetMouseXPos is triggerd/updated when you move over a layer etc.

I did a quick add in the code, you can download a "beta" version here: http://www.avedesk.org/download.php?id=2

Before releasing your desklet let me know I'll update the site with a new version, but this will let you continue with your desklet.

I haven't had a chance to test the code, but I'm assuming it works. Let me know

Desklet.Desktop.MouseX and MouseY

Sorry for quick post, just really busy with work :(

#444950

I'm in front of my gf's pc right now, but I'll check it as soon as I get home - thaaaaank you ^^

#445066

Doesn't seem to work :(

function onClick()

{

var MouseXPos = Desklet.Desktop.MouseX;

var MouseYPos = Desklet.Desktop.MouseY;

alert(MouseXPos + "," + MouseYPos)

}

5009  Runtime Error in Microsoft JScript

'Desklet' is undefined Line:5 Column:1

#445608

Desklet is undefined?? You mean desklet.desktop.

I should be desklet.ui.desktop.mousex

forgot the UI

#445739

Oooh, I feel stupid now. Apologies!

...and thankies, too :)

#445789