3 Replies Latest reply: Apr 25, 2016 7:35 AM by Chris Porthouse RSS

    In Automator, Script Option create issue

    Avinash Singh

      Hi all

       

      In Datawatch Automator, I am trying to write a Batch File Run script in Script Option of Virtual Process and getting some error.

      script_error.png

      I am trying to run this VB.net script

       

      try

        dim ok as integer = Shell("C:\DS\Automator\Oracle_BCP\Incremental_BulkInsert.bat",AppWinStyle.Hide,True)

        if ok<>0 then log.addevent("Error failed to bulk insert")

      catch ex as Exception

        log.addevent("Error failed to bulk insert " & ex.message)

      end try

       

       

      This script is giving these errors

      • 'Shell' is not declared. It may be inaccessible due to its protection level.
      • 'AppWinStyle' is not declared. It may be inaccessible due to its protection level.
      • 'log' is not declared. It may be inaccessible due to its protection level.
      • 'log' is not declared. It may be inaccessible due to its protection level.
        • Re: In Automator, Script Option create issue
          mperez

          Hi Avinash Singh,

           

          I'm not sure if your Script is correct but here's some guidelines you might check for the below error.


          Error: Name '<name>' is not declared. It may be inaccessible due to its protection level.

           

          To correct this error:

          1. Check the spelling of the name in the referring statement. Visual Basic is case-insensitive, but any other variation in the spelling is regarded as a completely different name. Note that the underscore (_) is part of the name and therefore part of the spelling.

          2. Check that you have the member access operator (.) between an object and its member. For example, if you have a TextBoxcontrol named TextBox1, to access its Text property you should type TextBox1.Text. If instead you type TextBox1Text, you have created a different name.

          3. If the spelling is correct and the syntax of any object member access is correct, verify that the element has been declared.

          4. If the programming element has been declared, check that it is in scope. If the referring statement is outside the region declaring the programming element, you might need to qualify the element name.

           

          Hope this helps.

           

          Thanks.

          • Re: In Automator, Script Option create issue
            Chris Porthouse

            You need to add the references in your script.  Try adding the following lines:

            ' Default Imports...

            Imports Datawatch.Common.Scripting.Api.UserScripting

            Imports Microsoft.VisualBasic

            Imports System

            Imports System.Collections.Specialized

            Imports System.Diagnostics

            Imports System.Windows.Forms