Skip to main content
InSource Solutions

TN AppSvr207 How to capture the mouse cursor from within an ArchestrA graphic

InSource_Logo_Transparent (1).pngCount5.JPG

Description

 

This article from InSource shows how to capture the mouse cursor from within an ArchestrA graphic using Wonderware Application Server.

  • Author: Joseph Hefner
  • Published: 7/26/2016
  • Applies to: Application Server 2014 R2 or later.

Details

Step 1: Import the System.Windows.Forms dll by going to Galaxy \ Import \ Script Function Library and choosing the dll from the following location:

C:\Windows\Microsoft.NET\Framework\v4.0.30319

SS1.jpg

SS2.jpg

SS3.jpg

 

Step 2: Create custom properties to hold the cursor values.  In this example, they are called XPos and YPos.

SS4a.jpg

SS4b.jpg

Step 3:  Create a graphic to display the values and link them to the custom properties:

SS5.jpg

SS6.jpg

SS7.jpg

SS8.jpg

SS9.jpg

Step 4: Right click a blank space in the graphic and choose "Scripts" and add the script below to assign the cursor values to the customer property:

 

XPos = System.Windows.Forms.Cursor.Position.X;
YPos = System.Windows.Forms.Cursor.Position.Y;

SS10.jpg

SS11.jpg