It is currently April 19th, 2024, 7:28 am

What monitor is the cursor currently on?

Get help with creating, editing & fixing problems with skins
User avatar
StArL0rd84
Posts: 424
Joined: February 8th, 2015, 10:07 pm
Location: EU, Denmark.

What monitor is the cursor currently on?

Post by StArL0rd84 »

Have looked around a bit for a plugin/script that could tell me what monitor the cursor is currently on.
Maybe you know if something like this exists?

Explanation:
I am making a suite for a touch screen
And the Windows works it moves the cursor to the point on the touch screen that's tapped. urrk
But i had a breakthrough sending the mouse cursor back to correct position on the main monitor after i tap the touch screen, using a combination of the MouseXY plugin and NirCMD > setcursor
But i need something to tell me when the cursor is not on the touch screen, so i can know when to log the mouse X and Y position.

I need to know 3 values to make this work nicely.
1. What monitor the skin is on.
2. How many monitors are connected.
3. What monitor is the cursor currently on.

I can measure 1 & 2 but still need 3.

This thread looks interesting but don't have the faintest idea how to use the information:
https://stackoverflow.com/questions/26402955/finding-monitor-screen-on-which-mouse-pointer-is-present

7 inches baby ;P
_MG_6673.JPG
You do not have the required permissions to view the files attached to this post.
([mWorkTime] = 1 ? #Work# : ([mEnergyLoss:%] >= 70% ? #Chillmode# : </>))
User avatar
StArL0rd84
Posts: 424
Joined: February 8th, 2015, 10:07 pm
Location: EU, Denmark.

Re: What monitor is the cursor currently on?

Post by StArL0rd84 »

This matter is now solved.
I made a second skin which follows the cursor and then reports to the main skin what monitor it is on.
Then i compare the two there.
And then take the appropriate action.

Main Skin:

Code: Select all

[mMouseX]
 Measure=Plugin
 Plugin=MouseXY
 Dimension=X
 Disabled=1
 Group=mMouse
[mMouseY]
 Measure=Plugin
 Plugin=MouseXY
 Dimension=Y
 Disabled=1
 Group=mMouse

[mMouseMovement]
 Measure=Calc
 Formula=[mMouseX][mMouseY]
 OnChangeAction=[!SetVariable "MouseReturn" "[#nircmd# setcursor [mMouseX] [mMouseY]]"][!UpdateMeter *][!Redraw]
 DynamicVariables=1
 Disabled=1
 Group=mMouse
 
[mNumMon]
 Measure=Plugin
 Plugin=SysInfo
 SysInfoType=NUM_MONITORS
[mCurrMon]
 Measure=Script
 ScriptFile=#@#lua\CurrentMonitor.lua
 NumMonitors=[mNumMon]
 DynamicVariables=1

[mCursorIsOnMonitor]
 Measure=Calc
 Formula=[mCurrMon]
 DynamicVariables=1
 Group=SetCursor
 
[mUpdateMouseReturn]
 Measure=Calc
 IfCondition=[mCurrMon]<>[mCursorIsOnMonitor]
 IfTrueAction=[!EnableMeasureGroup mMouse]
 IfFalseAction=[!DisableMeasureGroup mMouse]
 DynamicVariables=1
 Group=SetCursor
Second skin:

Code: Select all

[Rainmeter]
Update=16
DynamicWindowSize=1
OnRefreshAction=[!ZPos "-2"]

[mMouseX]
 Measure=Plugin
 Plugin=MouseXY
 Dimension=X
[mMouseY]
 Measure=Plugin
 Plugin=MouseXY
 Dimension=Y

[mMouseMovement]
 Measure=Calc
 Formula=[mMouseX][mMouseY]
 OnChangeAction=[!Move "[mMouseX]" "[mMouseY]"]
 DynamicVariables=1

[mNumMon]
 Measure=Plugin
 Plugin=SysInfo
 SysInfoType=NUM_MONITORS

[mCurrMon]
 Measure=Script
 ScriptFile=#@#lua\CurrentMonitor.lua
 NumMonitors=[mNumMon]
 DynamicVariables=1

[MousePos]
 Meter=String
 MeasureName=mCurrMon
 Text=%1
 FontSize=22
 FontColor=255,255,215
 SolidColor=0,0,0
 DynamicVariables=1
 X=1r
 Y=1r

[mUpdateMouseReturn]
 Measure=Calc
 Formula=[mCurrMon]
 OnChangeAction=[!SetOption "mCursorIsOnMonitor" "Formula" "[mCurrMon]" "Taptic\TapticVertical"][!UpdateMeasureGroup "SetCursor" "Taptic\TapticVertical"]
 DynamicVariables=1
Current monitor Lua script:
https://forum.rainmeter.net/viewtopic.php?t=21545

MouseXY Plugin:
https://forum.rainmeter.net/viewtopic.php?p=120800#p120800

NirCMD: (Download at bottom of page)
http://www.nirsoft.net/utils/nircmd.html
([mWorkTime] = 1 ? #Work# : ([mEnergyLoss:%] >= 70% ? #Chillmode# : </>))