Processing Ajax...

Title

Message

Confirm

Confirm

Confirm

Confirm

Are you sure you want to delete this item?

Confirm

Are you sure you want to delete this item?

Move Mouse to Next Monitor and Position at 800,600 (在任何界面都可以从一个屏幕跳到另一个屏幕)

Description
This script moves the mouse to the next monitor and positions it at 800 x 600.
Language
C#.net
Minimum Version
Created By
TianXia91400
Contributors
-
Date Created
Oct 24, 2019
Date Last Modified
Oct 24, 2019

Scripted Function (Macro) Code

using System;
using System.Drawing;

public static class DisplayFusionFunction
{
	public static void Run(IntPtr windowHandle)
	{
        BFS.Window.Focus(BFS.Window.GetWindowByClass("WorkerW"));
        //Get the mouse X,Y values (获取鼠标的XY值)
        int x = BFS.Input.GetMousePositionX();
        int y = BFS.Input.GetMousePositionY();
        //Get the current monitor ID that the mouse is on (通过鼠标位置获取当前的监视器ID)
        uint currentMonitor = BFS.Monitor.GetMonitorIDByXY(x, y);
        //Get all monitor IDs (获取所有监视器ID)
        uint[] ids = BFS.Monitor.GetMonitorIDs();
        //Find the current monitor in the array (查找我们在监视器ID数组中的位置)
        int index = -1;
        for(int i = 0; i < ids.Length; i++)
        {
            if(ids[i] != currentMonitor)
                continue;
                
            index = i;
            break;
        }
        
        //If index isn't found, exit script (如果找不到索引,请退出脚本)
        if(index == -1)
            return;
            
        //Find the next monitor ID (查找下一个监视器ID)
        uint nextMonitorID = ids[++index % ids.Length];
        var mBounds = BFS.Monitor.GetMonitorBoundsByID(nextMonitorID);
		BFS.Input.SetMousePosition(mBounds.X, mBounds.Y);
		BFS.Input.SetMousePosition(mBounds.X + 800, mBounds.Y + 600);
	}
}