Save up to 50% off any of our desktop apps in our 2021 spring sale, including
DisplayFusion, ClipboardFusion, FileSeek, LogFusion, TrayStatus, and VoiceBot!

Title

Message

Confirm

<< DiscussionsReply

Mouse Cursor position

trampmasta
2 discussion posts
Hello, I am working on a few scripted functions that require the cursor to be a certain x,y or things will go very wrong. Getting an x,y for the cursor seems like something that would be included in DisplayFusions Functions tab. Am I just missing it?
Mar 1, 2021  • #1
Owen Muhlethaler (BFS)'s profile on WallpaperFusion.com
Hello,

If your looking to get the mouse position, you can use the two lines below:

BFS.Input.GetMousePositionX();
BFS.Input.GetMousePositiony();

If your looking to set the mouse position, you can use the line below:

BFS.Input.SetMousePosition(x, y);

Hope that helps!
Mar 2, 2021  • #2
trampmasta
2 discussion posts
So I was definitely trying to get the mouse position but was needing to get it and then add it into our script that automates some clicks. My C# is a bit rusty but i found BFS.Dialog that will create a window and show you the value! if there is an easier way to do this i am open to it though. this is the script i used.

public static class DisplayFusionFunction
{
public static void Run(IntPtr windowHandle)
{
int mouseX = BFS.Input.GetMousePositionX();
int mouseY = BFS.Input.GetMousePositionY();

BFS.Dialog.ShowMessageInfo("(" + mouseX.ToString() + ", " + mouseY.ToString() + ")");
}
}

Edited that a few times but this one was the "best answer" This can be marked as complete!
Mar 2, 2021 (modified Mar 3, 2021)  • #3
Owen Muhlethaler (BFS)'s profile on WallpaperFusion.com
Hello,

Glad to hear you got it working! If you have any other questions, feel free to reach out to us.

Thanks!
Mar 3, 2021  • #4
Was this helpful?    
<< DiscussionsReply