# ScriptStart Method - neoVI API

This method starts the execution of a script that has been downloaded to a neoVI device.

{% tabs %}
{% tab title="C/C++ Declare" %}

```cpp
int _stdcall icsneoScriptStart(void * hObject, int iLocation);
```

{% endtab %}

{% tab title="Visual Basic .NET Declare" %}

```vbnet
Public Declare Function icsneoScriptStart Lib “icsneo40.dll” (ByVal hObject As IntPtr, ByVal iLocation As Int32) As Int32
```

{% endtab %}

{% tab title="C# Declare" %}

```csharp
[DllImport(“icsneo40.dll”)] public static extern Int32 icsneoScriptStart(IntPtr hObject, Int32 iLocation);
```

{% endtab %}
{% endtabs %}

**Parameters**

hObject

\[in] Specifies the driver object created by [OpenNeoDevice](https://docs.intrepidcs.com/neovi-api/win32-api-overview-intrepidcs-api/basic-functions-overview-intrepidcs-api/openneodevice-method-intrepidcs-api).

iLocation

\[in] Specifies the physical location of the script to be executed on the neoVI device. Valid values are:

SCRIPT\_LOCATION\_FLASH\_MEM = 0 (Valid only on a neoVI Fire or neoVI Red)SCRIPT\_LOCATION\_SDCARD = 1 (Valid only on a neoVI Fire or neoVI Red)SCRIPT\_LOCATION\_VCAN3\_MEM = 2 (Valid only on a ValueCAN 3 device)

These values are defined in the icsnVC40.h file

**Return Values**

1 if the function succeeded. 0 if it failed for any reason. [GetLastAPIError](https://docs.intrepidcs.com/neovi-api/win32-api-overview-intrepidcs-api/error-functions-overview-intrepidcs-api/getlastapierror-method-intrepidcs-api) must be called to obtain the specific error. The errors that can be generated by this function are:

NEOVI\_ERROR\_DLL\_NEOVI\_NO\_RESPONSE = 75

NEOVI\_ERROR\_DLL\_INVALID\_SCRIPT\_LOCATION = 213

NEOVI\_ERROR\_DLL\_SDCARD\_NOT\_INSERTED = 214

NEOVI\_ERROR\_DLL\_SCRIPT\_START\_ERROR = 218

**Remarks**

The script must have been successfully downloaded to the neoVI using [LoadScript](https://docs.intrepidcs.com/neovi-api/win32-api-overview-intrepidcs-api/deprecated-functions-overview-intrepidcs-api/coremini-script-interface-overview-intrepidcs-api/scriptload-method-intrepidcs-api). Use [ScriptStop](https://docs.intrepidcs.com/neovi-api/win32-api-overview-intrepidcs-api/deprecated-functions-overview-intrepidcs-api/coremini-script-interface-overview-intrepidcs-api/scriptstop-method-intrepidcs-api) to suspend execution of the script. If the connected device is a ValueCAN 3 and a location other than SCRIPT\_LOCATION\_VCAN3\_MEM will generate an error.

### Examples

{% tabs %}
{% tab title="C/C++ Example:" %}

```cpp
int iRetVal;
unsigned long lLastErrNum;

printf("Attempting to start the script\n");
iRetVal = icsneoScriptStart(hObject, DefaultScriptLocation);
if(iRetVal == 0)
{
    printf("Failed to start the script API Error\n");
}
else
{
    printf("Successfully started the script\n");
}
```

{% endtab %}

{% tab title="C# Example:" %}

```csharp
Int32 iResult;

//Start CoreMini
iResult = icsNeoDll.icsneoScriptStart(m_hObject, Convert.ToInt32(CoreMiniStoreLocation.SCRIPT_LOCATION_FLASH_MEM));

if(iResult == 0)
{
    lblCMStatus.Text = "CoreMini Failed to Start";
}
else
{
    lblCMStatus.Text = "CoreMini Started";
}
```

{% endtab %}

{% tab title="Visual Basic .NET Example:" %}

```vbnet
Dim iResult As Int32

'//Start CoreMini
iResult = icsneoScriptStart(m_hObject, SCRIPT_LOCATION_FLASH_MEM)

If iResult = 0 Then
    lblCMStatus.Text = "CoreMini Failed to Start"
Else
    lblCMStatus.Text = "CoreMini Started"
End If
```

{% endtab %}
{% endtabs %}
