Script Commands

 

This group of commands is used to perform  Movicon VBA Script operations.

 

 

Script

The name of the Script VBA to be run or stopped is entered in this edit box (or selected with the '...' browse button on the right).

 

When you need to select a script from a child project, you should use  the following syntax:

 

ChildProjectName\ScriptName

 

When you need to select a script from a Parent project, you should use the following syntax:

 

..\ScriptName

 

Action

This property allows you to select the action that has to be executed for the selected VBA Script. The options are:

 

Action

Description

Run Normal

Runs the script in normal mode

 

Run Synchro

The Basic Script is started up synchroned with the component or interface that runs it and which will remain blocked until the called Basic Script has terminated.   

 

In cases where more then one Instance is called, the 'Timeout' must be set with a time that is major to the time used for running the called Script Resource, otherwise a 'maximum number of instances has been reached' error message will display in the System Log.

 

Run Safe

Runs the script in Safe mode. In this case, the script will be run in a new Movicon process, allowing the Movicon application to be saved if the script raises an exception. Please keep in mind that loading/unloading script is quite slow.

 

The Local Transport in the Networking settings will need to be enabled if the Basic Script is to interact with  RealtimeDB variables.

 

 

Stop

Stops the script from running without unloading it from memory.

 

Unload

Unloads the script from memory

The unload command of a basic script resource unloads only those basic resources which are being run in separate threads from memory. The other basic script resources being run in the same thread are only stopped. As a consequence of this, the "Unloading" event is no longer executed following an unload command for those basic script resources which are not in separate threads. In addition, the variables used by the basic script will always remain in use once the basic script has been run at least once.

 

 

Parameters

Allows you to set  the eventual script parameters.  Each parameter must be separated by the "," (comma) character.

 

Start,1,500

 

The example above is considered as three parameters "Start", "1" and "500". The "GetParameter()" function from the  "ScriptMEInterface" should then be used within the Basic Script routine for retrieving the parameters.

 

New Instance allowed

This property allows you to  run more instances from the same Basic Script at the same time. In order for this to work property, you will need to specify a number higher than one set in the Basic Script's  property.

 

Allow more Instances

When the Action type is set as 'Normal Run', this property will allow more instances of the same Basic Script Resource to run sequentially or simultaneously in accordance with the value specified in the "Maximum Instances" property if set with more than one VB Script resource.  Otherwise, a 'maximum number of instances reached' error message will be printed.  In addition, if the VB Script Resource is in a Separate Thread, the instanced will be run simultaneously.  Otherwise, the multiple calls will be buffered and run in a sequence, one after another, once the previous one has terminated.  

 

Timeout

This property allows you to enter a timeout by taking into account when the Basic Script is run in synchronized mode. The Basic Script will release the interface which called it when the timeout expires.

 

 

See Also