'This script gets a value from user and writes it to the tag.
Imports System 'Importing necessary classes.
Imports System.IO
Imports System.Windows.Forms
Imports Microsoft.VisualBasic
Namespace WinTr
Public Class MainClass
Public Tag_1 As Uint16 'WinTr tag variable is defined.
Public Sub Load 'Load procedure is defining.
'Script starts working within this procedure.
'WinTr tags should be accessed from this procedure.
'When this procedure finished working,
'WinTr tags can not be reached anymore from this script.
'------- Script Start Line -------
Try
Dim myValue As Object
'Screen keyboard is launching
System.Diagnostics.Process.Start("osk") 'On screen key board open
'Input box displaying containing Tag_1 value.
Again: myValue = InputBox( "Please enter the Tag value and press 'OK'","Input Value", Tag_1)
If myValue = "" Then 'If nothing entered
Exit Sub 'Exit procedure.
End If
If isnumeric(myValue) = True then 'If entered value is numeric
If myValue > 0 and myValue <= 100 Then 'if value between 0 and 100
Tag_1 = myValue 'Assign value to Tag_1.
Else
MsgBox("Value can be a number between 0 and 100")
Goto Again 'Go to again labeled line.
End If
Else
MsgBox("Value can only be a number")
Goto Again
End If
Catch ex As Exception
MessageBox.Show(Ex.ToString,Ex.Message)
End Try
'------- Script End Line -------
End Sub
End Class
End Namespace