Loading API Index...
Open Automation Software API Documentation
Show / Hide Table of Contents

Options

GetOption

  • Returns the value of the configuration option specified in the first paramater as an object.
C#
using System;

namespace OASDataSample
{
    class Program
    {
        static OASConfig.Config oasc = new OASConfig.Config();
        static void Main(string[] args)
        {

            {
                string errorString = "";
                string networknode = "localhost";
                object fileName = oasc.GetOption("Default Tag Configuration File", networknode, ref errorString);


                if (errorString == "Success")
                {
                    Console.WriteLine(fileName);
                }
                else
                {
                    Console.WriteLine(errorString);
                }
            }
        }
    }
}
VB
Imports System

Namespace OASDataSample
    Class Program
        Shared oasc As OASConfig.Config = New OASConfig.Config()

        Public Shared Sub Main(ByVal args As String())
            If True Then
                Dim errorString As String = ""
                Dim networknode As String = "localhost"
                Dim fileName As Object = oasc.GetOption("Default Tag Configuration File", networknode, errorString)

                If errorString = "Success" Then
                    Console.WriteLine(fileName)
                Else
                    Console.WriteLine(errorString)
                End If
            End If
        End Sub
    End Class
End Namespace

SetOption

  • Sets a Configuration Option.
  • First parameter is the option name. Second parameter is the option value.
C#
using System;

namespace OASDataSample
{
    class Program
    {
        static OASConfig.Config oasc = new OASConfig.Config();
        static void Main(string[] args)
        {

            {
                string errorString = "";
                string networknode = "localhost";
                string resultString = oasc.SetOption("Default Tag Configuration File", @"C:\Tags\DemoTags.Tags", networknode, ref errorString);

                if (errorString == "Success")
                {
                    Console.WriteLine(resultString);
                }
                else
                {
                    Console.WriteLine(errorString);
                }
            }
        }
    }
}
VB
Imports System

Namespace OASDataSample
    Class Program
        Shared oasc As OASConfig.Config = New OASConfig.Config()

        Public Shared Sub Main(ByVal args As String())
            If True Then
                Dim errorString As String = ""
                Dim networknode As String = "localhost"
                Dim resultString As String = oasc.SetOption("Default Tag Configuration File", "C:\Tags\DemoTags.Tags", networknode, errorString)

                If errorString = "Success" Then
                    Console.WriteLine(resultString)
                Else
                    Console.WriteLine(errorString)
                End If
            End If
        End Sub
    End Class
End Namespace

GetOptions

Returns two arrays: (1) an array of option names; (2) an array of options values.

C#
using System;

namespace OASDataSample
{
    class Program
    {
        static OASConfig.Config oasc = new OASConfig.Config();
        static void Main(string[] args)
        {

            {
                string errorString = "";
                string networknode = "localhost";
                object[] arrOptions = oasc.GetOptions(false, networknode, ref errorString);

                if (errorString == "Success")
                { 
                    object[] options = (object[])arrOptions[0];
                    object[] values = (object[])arrOptions[1];


                    for (int i = 0; i < options.Length; i++)
                    {
                        Console.WriteLine(options[i] + "|" + values[i]);

                    }

                }
                else
                {
                    Console.WriteLine(errorString);
                }
            }
        }
    }
}
VB
Imports System

Namespace OASDataSample
    Class Program
        Shared oasc As OASConfig.Config = New OASConfig.Config()

        Public Shared Sub Main(ByVal args As String())
            If True Then
                Dim errorString As String = ""
                Dim networknode As String = "localhost"
                Dim arrOptions As Object() = oasc.GetOptions(False, networknode, errorString)

                If errorString = "Success" Then
                    Dim options As Object() = CType(arrOptions(0), Object())
                    Dim values As Object() = CType(arrOptions(1), Object())

                    For i As Integer = 0 To options.Length - 1
                        Console.WriteLine(options(i) & "|" & values(i))
                    Next
                Else
                    Console.WriteLine(errorString)
                End If
            End If
        End Sub
    End Class
End Namespace

SetOptions

  • Sets the OAS configuration options found under Configure >> Options.
  • The first paramater is a string array of the headers of the options to set. The second paramater is an object array of the option values.
C#
using System;

namespace OASDataSample
{
    class Program
    {
        static OASConfig.Config oasc = new OASConfig.Config();
        static void Main(string[] args)
        {

            {
                string errorString = "";
                string networknode = "localhost";
                string[] OptionNames = new string[2];
                object[] OptionValues = new object[2];
                OptionNames[0] = "Load Default Tag Configuration";
                OptionValues[0] = true;
                OptionNames[1] = "Default Tag Configuration File";
                OptionValues[1] = @"C:\Tags\DemoTags.Tags";
                string resultString = oasc.SetOptions(OptionNames, OptionValues, networknode, ref errorString);

                if (errorString == "Success")
                {
                    Console.WriteLine(resultString);
                }
                else
                {
                    Console.WriteLine(errorString);
                }
            }
        }
    }
}


VB
Imports System

Namespace OASDataSample
    Class Program
        Shared oasc As OASConfig.Config = New OASConfig.Config()

        Public Shared Sub Main(ByVal args As String())
            If True Then
                Dim errorString As String = ""
                Dim networknode As String = "localhost"
                Dim OptionNames As String() = New String(1) {}
                Dim OptionValues As Object() = New Object(1) {}
                OptionNames(0) = "Load Default Tag Configuration"
                OptionValues(0) = True
                OptionNames(1) = "Default Tag Configuration File"
                OptionValues(1) = "C:\Tags\DemoTags.Tags"
                Dim resultString As String = oasc.SetOptions(OptionNames, OptionValues, networknode, errorString)

                If errorString = "Success" Then
                    Console.WriteLine(resultString)
                Else
                    Console.WriteLine(errorString)
                End If
            End If
        End Sub
    End Class
End Namespace

Back to top Copyright (c) Open Automation Software. All rights reserved.