ScriptStart Method - intrepidcs API¶
C/C++ declare - VB.NET declare - C# declare - Parameters - Return Values - Remarks - C/C++ example - VB.NET example - C# example
This method starts the execution of a script that has been downloaded to a neoVI device.
C/C++ Declare¶
int _stdcall icsneoScriptStart(void * hObject, int iLocation);
Visual Basic .NET Declare¶
Public Declare Function icsneoScriptStart Lib “icsneo40.dll” (ByVal hObject As IntPtr, ByVal iLocation As Int32) As Int32
C# Declare¶
[DllImport(“icsneo40.dll”)] public static extern Int32 icsneoScriptStart(IntPtr hObject, Int32 iLocation);
Parameters¶
- hObject
[in] Specifies the driver object created by OpenNeoDevice.
- 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 must be called to obtain the specific error. The errors that can be generated by this function are:
Remarks¶
The script must have been successfully downloaded to the neoVI using LoadScript. Use ScriptStop 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¶
C/C++ Example:¶
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");
}
C# Example:¶
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";
}
Visual Basic .NET Example:¶
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