Skip to main content
InSource KnowledgeCenter

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

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

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.JPGSS7.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