Support Forums
Spawn() not working in an SRC File, also Report Destination "Parameter Expression" not working

Problem 1: I'm trying to execute a file based on a trigger. It is to accomplish something another SCADA software could do. It will run a batch file that combines csv files into 1 csv file. I am using a trigger tag to change an analog value. Then use that analog value to execute a script tag. The new SRC file (SpawnFile.SRC) and variable was declared in the AppRoot.SRC file per the help documentation and does run. I can tell because at the end of this script, the returned value to the script tag does change per this code.

However, using Spawn function anywhere in my script will not import (invalid function). Using \system.spawn allows the import but does nothing. Any advice appreciated.

{============================ Spawn Module ===================================}

(
   PointObj              { object value of Analog Status to monitor   (input)  };
   ScriptObj             { Script tag object                          (output) };
)
[ { Local variable }
]
SpawnFile [

    \System.Spawn("c:\reports\helloworld.txt");

      ScriptObj\Value = PointObj\Value + 1.0;
]

Problem 2: The other issue I have is in the report tag type, I want the file destination to change during runtime. Without user intervention. That way, reports can be organized into a folder structure based on the date.
I select csv file as the output, right click the file path field, and select parameter expression. I select a string tag that represents the file path. The "C" gets cut off from the string value and the field blue color goes away and is no longer dynamic. I'm guessing this is not possible?

Problem 1: I'm trying to execute a file based on a trigger. It is to accomplish something another SCADA software could do. It will run a batch file that combines csv files into 1 csv file. I am using a trigger tag to change an analog value. Then use that analog value to execute a script tag. The new SRC file (SpawnFile.SRC) and variable was declared in the AppRoot.SRC file per the help documentation and does run. I can tell because at the end of this script, the returned value to the script tag does change per this code. However, using Spawn function anywhere in my script will not import (invalid function). Using \system.spawn allows the import but does nothing. Any advice appreciated. ```` {============================ Spawn Module ===================================} ( PointObj { object value of Analog Status to monitor (input) }; ScriptObj { Script tag object (output) }; ) [ { Local variable } ] SpawnFile [ \System.Spawn("c:\reports\helloworld.txt"); ScriptObj\Value = PointObj\Value + 1.0; ] ```` Problem 2: The other issue I have is in the report tag type, I want the file destination to change during runtime. Without user intervention. That way, reports can be organized into a folder structure based on the date. I select csv file as the output, right click the file path field, and select parameter expression. I select a string tag that represents the file path. The "C" gets cut off from the string value and the field blue color goes away and is no longer dynamic. I'm guessing this is not possible?

Problem 1 - your Spawn function is only supported in Script, not Steady State, so it must be used in a script block, such as:

SpawnFile [
If AbsTime(1,10,0);
[
Spawn("C:\Windows\system32\cmd.exe" );
ScriptObj\Value = PointObj\Value + 1;
]
]

Please refer to the Scripting section in the VTScada Help files for more info on script blocks.
Also - the file you specify in your Spawn function (helloworld.txt) is not an executable.

Problem 1 - your Spawn function is only supported in Script, not Steady State, so it must be used in a script block, such as: SpawnFile [ If AbsTime(1,10,0); [ Spawn("C:\Windows\system32\cmd.exe" ); ScriptObj\Value = PointObj\Value + 1; ] ] Please refer to the Scripting section in the VTScada Help files for more info on script blocks. Also - the file you specify in your Spawn function (helloworld.txt) is not an executable.
30
1
2
live preview
enter atleast 10 characters
WARNING: You mentioned %MENTIONS%, but they cannot see this message and will not be notified
Saving...
Saved
With selected deselect posts show selected posts
All posts under this topic will be deleted ?
Pending draft ... Click to resume editing
Discard draft