Difference between revisions of "NVGate Macro"
(→Trace) |
|||
(40 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
[[category:NVGate]] | |||
===Tutorial=== | ===Tutorial=== | ||
A macro is a powerful automation tool of NVGate allowing to create your own programs from a simple graphic interface, and doesn't require any software development skills.<br> | A macro is a powerful automation tool of NVGate allowing to create your own programs from a simple graphic interface, and doesn't require any software development skills.<br> | ||
Line 6: | Line 6: | ||
====Creating a new Macro==== | ====Creating a new Macro==== | ||
Go in the [[NVGate Ribbons: Tools Tab|" | Go in the [[NVGate Ribbons: Tools Tab|"Automation" tab of the NVGate ribbon]], and select "New" in the Macro group: | ||
[[ | [[File:Macro_new_2022.JPG|700px]] | ||
====Add a parameter==== | ====Add a parameter==== | ||
Line 36: | Line 36: | ||
In order to loop as long as needed, we will use a "while" loop that iterates as long as "EnableMacro" is set on "True". | In order to loop as long as needed, we will use a "while" loop that iterates as long as "EnableMacro" is set on "True". | ||
The while loop is an Algorithmic command, and will be added the same way as the Affectation command. Click on "End of Macro", click on the [[Image:AlgoCommandIcon.png]] icon and select "while loop. Then set the loop as follows : | The while loop is an Algorithmic command, and will be added the same way as the Affectation command. Click on "End of Macro", click on the [[Image:AlgoCommandIcon.png]] icon and select "while loop". Then set the loop as follows : | ||
[[Image:WhileLoop.png|600px|none]] | [[Image:WhileLoop.png|600px|none]] | ||
Line 66: | Line 66: | ||
You can stop the macro anytime by using the "pause" option of the macro editor [[Image:PauseMacro.png]] and set the "EnableMacro" parameter on "False". | You can stop the macro anytime by using the "pause" option of the macro editor [[Image:PauseMacro.png]] and set the "EnableMacro" parameter on "False". | ||
====Launch the Macro==== | |||
Use the [[NVGate Control Panel|control panel]] to launch the macro in NVGate. | |||
====Execute a .exe in a macro==== | |||
This allows you to launch an external .exe or .bat. with a macro. | |||
<br> | |||
[[File:macro_link.png]] | |||
Process:<br> | |||
- Put your .exe in C:\OROS\NVGate data\Links<br> | |||
- click on "record on line buton". | |||
[[File:RecordOnLine.png]]<br> | |||
- Select the .exe using the [[NVGate_Ribbons:_Tools_Tab#Link|NVGate Link]]<br> | |||
- stop the "record on line".<br> | |||
===Macros group=== | |||
<Youtube>https://www.youtube.com/watch?v=6IIKsHwZi2Y</Youtube> | |||
The macros group is used to create/manage macros that perform automatically recurrent operations. | |||
[[Image:Reports_Tools_Ribbons_58.png|200px|none]] | |||
[[Image: | {|border="0" cellspacing="0" cellpadding="4" width="100%" align="center" | ||
|-valign = "top" | |||
|[[Image:Reports_Tools_Ribbons_59.png|30px|none]] | |||
|'''Manage''': Open the [[NVGate_Macro#Macros_Manager|macros manager]]. | |||
= | |-valign = "top" | ||
[[Image: | |[[Image:Reports_Tools_Ribbons_62.png]] | ||
|'''New''': Create a new macro and load it in the macro editor. This menu is disabled if another macro is being edited. | |||
|-valign = "top" | |||
|[[Image:Reports_Tools_Ribbons_75.png]] | |||
|'''Save''': Save the macro currently edited. Only available if a macro is being edited. | |||
[[Image: | |-valign = "top" | ||
|[[Image:Reports_Tools_Ribbons_76.png]] | |||
|'''Save as''': Save the macro currently edited with a new name. Only available if a macro is being edited. | |||
|-valign = "top" | |||
|[[Image:Reports_Tools_Ribbons_77.png]] | |||
|'''Record''': Start recording the user action on the software. Each recorded action is appended to the Macro and will be a visible line in the macro editor. | |||
Prior to start the macro recording user must enter the macro name and the recording mode: | |||
* '''Edit: ''' | * Macro name: Name of the macro. | ||
* '''New: ''' | * Recording mode: | ||
* '''Delete: ''' | |||
* '''Run: ''' | {|class="wikitable" style="background:white" border="2" cellspacing="0" cellpadding="4" width="70%" | ||
* '''Properties: ''' | |'''Mode''' | ||
|'''Description''' | |||
|- | |||
|On-line | |||
|Commands corresponding to user actions are recorded in the macro. | |||
|- | |||
|Off-line | |||
|User actions have no effect. Commands corresponding to user actions are recorded in the macro. | |||
|} | |||
''Note: Click on the record button to stop recording the macro. The macro is saved with the name specified in the "Record" dialog.'' | |||
|-valign = "top" | |||
|[[Image:Reports_Tools_Ribbons_78.png]] | |||
|'''Pause record''': Pause the ongoing macro record. User actions are not yet recorded. Available if macro is being recorded. | |||
Useful to prepare the system for an action to be recorded without filling the editor with unwanted lines. | |||
|-valign = "top" | |||
|[[Image:Reports_Tools_Ribbons_79.png]] | |||
|'''Stop run''': Stop the execution of the running macro. Available if macro is running. | |||
|}<br clear="all"> | |||
====Macros Manager==== | |||
Display the macros list and the associated hot-keys. A hot-key is a shortcut to run the macro.<br><br> | |||
[[Image:Reports_Tools_Ribbons_60.png|300px|none]] | |||
''Note: the three first hot keys are automatically assigned in the "Macro" menu from the OR38/OR36 Front Panel, labeled as "0", "1" and "2".'' | |||
* '''Edit: '''Edit the macro selected. Available if no macro is being edited, recorded, or executed. | |||
* '''New: '''Create a new macro. The new macro is opened in the editor. Available if no macro is being edited, recorded, or executed. | |||
* '''Delete: '''Delete the macro selected. | |||
* '''Run: '''Run the macro selected. Available if no macro is being executed. | |||
* '''Properties: '''Edit macro properties (name, read-only flag, and assigned hot-key). Available if no macro is being edited, recorded, or executed. | |||
[[Image:Reports_Tools_Ribbons_61.png|framed|none]] | [[Image:Reports_Tools_Ribbons_61.png|framed|none]] | ||
* '''Name:''' | * '''Name:''' Change the name of the macro. | ||
* '''Read-only:''' If the macro is read-only, the macro can be loaded to the macro editor but can<nowiki>’</nowiki>t be modified. | * '''Read-only:''' If the macro is read-only, the macro can be loaded to the macro editor but can<nowiki>’</nowiki>t be modified. | ||
* '''Hot key:''' | * '''Hot key:''' Define a hot-key to run the macro. | ||
* '''Assigned macro:''' Macro associated with the hot-key selected in "Hot-key" combo-box. If hot-key selected is already assigned, a message is generated when the window is closed, requesting confirmation of the new assignment. | * '''Assigned macro:''' Macro associated with the hot-key selected in "Hot-key" combo-box. If hot-key selected is already assigned, a message is generated when the window is closed, requesting confirmation of the new assignment. | ||
===Macro Editor=== | |||
This command is enabled if the macro item is selected in the macro tree. | |||
[[File:Macro_Editor_2022.JPG|400px]] | |||
{|border="0" cellspacing="0" cellpadding="4" width="100%" align="center" | |||
|-valign = "top" | |||
|[[Image:Reports_Tools_Ribbons_63.jpg]] | |||
|'''Properties''': Open a dialog box intended to edit [[NVGate_Macro#Macro_properties|macro properties]]. | |||
|-valign = "top" | |||
|[[Image:Reports_Tools_Ribbons_66.jpg]] | |||
|'''Delete''' : Delete the selected command in the macro tree. If the macro selected contains a set of commands (for example a loop command), a dialog box appears in order to confirm command removal. If removal is confirmed, the command and all commands it contains are deleted. | |||
This command is enabled if the macro is not running and it is not read-only. | |||
|-valign = "top" | |||
|[[Image:Reports_Tools_Ribbons_67.jpg]] | |||
|'''Run''': Run the macro from the current command (indicated by execution pointer) to the next breakpoint. If no breakpoint follows, the execution goes to the end of the macro. Enabled if the macro is not running. | |||
|-valign = "top" | |||
|[[Image:Reports_Tools_Ribbons_68.jpg]] | |||
|'''Pause''': Stop macro execution. The command running is completed, and then execution stops. | |||
This command is enabled when the macro is running only. | |||
|-valign = "top" | |||
|[[Image:Reports_Tools_Ribbons_69.jpg]] | |||
|'''Step next''': Run current command (indicated by execution pointer). This command is enabled when the macro is not running. | |||
|-valign = "top" | |||
|[[Image:Reports_Tools_Ribbons_70.jpg]] | |||
|'''Reset''': If the macro is running, stop the execution, and then set the execution pointer to the first command of the macro. | |||
|-valign = "top" | |||
|[[Image:Reports_Tools_Ribbons_71.jpg]] | |||
|'''Record on-line''': Record commands in the macro. The record on-line mode applies the user actions. The commands corresponding to actions are recorded and inserted in the macro before the selected command. This command is enabled if the macro is not running and it is not read-only. | |||
|-valign = "top" | |||
|[[Image:Reports_Tools_Ribbons_72.jpg]] | |||
|'''Record off-line''': Record commands in the macro. The record off line mode applies the user actions only when the macro will start. The commands corresponding to actions are recorded and inserted in the macro before the selected command. This command is enabled if the macro is not running and it is not read-only. | |||
|-valign = "top" | |||
|[[Image:Reports_Tools_Ribbons_73.jpg]] | |||
|'''Insert an algorithmic command''': Insert an [[NVGate_Macro#Algorithmic_commands|algorithmic command]] before the selected command. This command is enabled if the macro is not running and it is not read-only. | |||
|-valign = "top" | |||
|[[Image:Reports_Tools_Ribbons_74.jpg]] | |||
|'''Save''': Save the macro. | |||
|}<br clear="all"> | |||
====Macro properties==== | |||
Macro properties consist of a set of parameters of different types, which can be used to define macro command properties. This command is enabled if the macro item is selected in the macro tree. | |||
[[Image:Reports_Tools_Ribbons_64.png|framed|none]] | [[Image:Reports_Tools_Ribbons_64.png|framed|none]] | ||
Line 110: | Line 226: | ||
* '''Type''': type of the parameter. The different types available are | * '''Type''': type of the parameter. The different types available are | ||
{|border="2" cellspacing="0" cellpadding="4" width="100%" | {|class="wikitable" style="background:white" border="2" cellspacing="0" cellpadding="4" width="100%" | ||
|'''Type''' | |'''Type''' | ||
|'''Description''' | |'''Description''' | ||
Line 137: | Line 253: | ||
* '''Value''': default value of parameter | * '''Value''': default value of parameter | ||
* '''Edit: ''' | * '''Edit: '''Open the "Parameter properties" dialog box, which is used to edit the parameter selected in parameters list. It is possible to change the name, the type, or the default value of the parameter. If the parameter is used by one or more macro commands, the type can<nowiki>’</nowiki>t be edited (the "Type" combo-box is disabled). | ||
* '''Remove: '''Removes the selected parameter. If the parameter is used by one or more macro commands, the parameter is not removed and an error message is generated. | * '''Remove: '''Removes the selected parameter. If the parameter is used by one or more macro commands, the parameter is not removed and an error message is generated. | ||
====Algorithmic commands==== | |||
=====Affectation===== | |||
Line 210: | Line 264: | ||
Sets a value to a parameter. The new value can be defined by a parameter. | Sets a value to a parameter. The new value can be defined by a parameter. | ||
=====Break===== | |||
[[Image:macro_break.png|border|500px]] | [[Image:macro_break.png|border|500px]] | ||
Line 216: | Line 270: | ||
Used to exit a loop. It can be used inside a "for" loop to stop before the end of the iteration, inside a "while" loop to exit the loop without fulfilling the condition. It is the only way to exit a "Periodic loop". | Used to exit a loop. It can be used inside a "for" loop to stop before the end of the iteration, inside a "while" loop to exit the loop without fulfilling the condition. It is the only way to exit a "Periodic loop". | ||
=====Call Macro===== | |||
Calls another macro. | Calls another macro. | ||
Line 223: | Line 277: | ||
The only parameter is the name of the macro that is called. The body of the command is divided into three steps in order to exchange parameters between the calling macro and the called macro. | The only parameter is the name of the macro that is called. The body of the command is divided into three steps in order to exchange parameters between the calling macro and the called macro. | ||
=====Comment===== | |||
The purpose of this command is to facilitate understanding of the macro. It is used to add a comment line to the body of the macro. | The purpose of this command is to facilitate understanding of the macro. It is used to add a comment line to the body of the macro. | ||
Line 230: | Line 284: | ||
The only parameter is the comment. | The only parameter is the comment. | ||
====="For" loop===== | |||
[[Image:macro_for_loop.png|border|500px]] | [[Image:macro_for_loop.png|border|500px]] | ||
Line 236: | Line 290: | ||
Runs a set of commands several times. The number of iterations can be defined by an integer value or by an integer parameter. | Runs a set of commands several times. The number of iterations can be defined by an integer value or by an integer parameter. | ||
=====Get Current Time===== | |||
This command retrieves the time and stores it in a string parameter. This string may be use to send a trace, to create a measurement name... | This command retrieves the time and stores it in a string parameter. This string may be use to send a trace, to create a measurement name... | ||
Line 243: | Line 297: | ||
The "Time format" specifies the way in which the time should be written. "Date", "Time" and "Date and Time" use the regional settings of the host computer while the three other formats are fixed formats. | The "Time format" specifies the way in which the time should be written. "Date", "Time" and "Date and Time" use the regional settings of the host computer while the three other formats are fixed formats. | ||
=====Get Macro Parameter===== | |||
Gets the value of a parameter of a called macro. This command must be inserted between the "Exit macro" and the "Execute macro" commands, inside the body of the "Call Macro" command. | Gets the value of a parameter of a called macro. This command must be inserted between the "Exit macro" and the "Execute macro" commands, inside the body of the "Call Macro" command. | ||
Line 256: | Line 310: | ||
In this example, the command gets the value of the parameter nNumberOfLoop of the macro CheckInput and sets this value to the parameter nCount of the calling macro. | In this example, the command gets the value of the parameter nNumberOfLoop of the macro CheckInput and sets this value to the parameter nCount of the calling macro. | ||
=====Group===== | |||
The purpose of this command is to facilitate understanding of the macro. It creates a branch that contains a set of instructions. It has no effect during execution, but it helps to organize the macro and facilitates copying and pasting, since all commands are copied at once. | The purpose of this command is to facilitate understanding of the macro. It creates a branch that contains a set of instructions. It has no effect during execution, but it helps to organize the macro and facilitates copying and pasting, since all commands are copied at once. | ||
Line 263: | Line 317: | ||
[[Image:Reports_Tools_Ribbons_89.png|border|none]] | [[Image:Reports_Tools_Ribbons_89.png|border|none]] | ||
=====If…Then…===== | |||
[[Image:macro_if_then.png|border|500px]] | [[Image:macro_if_then.png|border|500px]] | ||
Line 296: | Line 350: | ||
* '''Alarm results''' | * '''Alarm results''' | ||
[[Image:Reports_Tools_Ribbons_96.png| | [[Image:Reports_Tools_Ribbons_96.png|600px|none]] | ||
* '''Advanced alarm: '''This condition is available only when at least one alarm on a double template result has been declared. | * '''Advanced alarm: '''This condition is available only when at least one alarm on a double template result has been declared. | ||
Line 306: | Line 360: | ||
[[Image:Reports_Tools_Ribbons_98.png|framed|none]] | [[Image:Reports_Tools_Ribbons_98.png|framed|none]] | ||
{|border="2" cellspacing="0" cellpadding="4" width=" | {|class="wikitable" style="background:white" border="2" cellspacing="0" cellpadding="4" width="70%" align="center" | ||
|'''Operator''' | |'''Operator''' | ||
|'''Test''' | |'''Test''' | ||
Line 401: | Line 455: | ||
[[Image:Reports_Tools_Ribbons_99.png|framed|none]] | [[Image:Reports_Tools_Ribbons_99.png|framed|none]] | ||
{|border="2" cellspacing="0" cellpadding="4" width=" | {|class="wikitable" style="background:white" border="2" cellspacing="0" cellpadding="4" width="70%" align="center" | ||
|'''Operator''' | |'''Operator''' | ||
|'''Test''' | |'''Test''' | ||
Line 494: | Line 548: | ||
|}<br clear="all"> | |}<br clear="all"> | ||
=====Incrementation===== | |||
[[Image:macro_incrementation.png|border|500px]] | [[Image:macro_incrementation.png|border|500px]] | ||
Line 504: | Line 558: | ||
Available if one or more integer or float parameter is defined. | Available if one or more integer or float parameter is defined. | ||
=====Make String===== | |||
Command used to create a string. | Command used to create a string. | ||
Line 515: | Line 569: | ||
"Add to existing string" is a Boolean parameter that indicates if the second parameter replaces or is added to first one. If the value is false, the command behaves like the Affectation command | "Add to existing string" is a Boolean parameter that indicates if the second parameter replaces or is added to first one. If the value is false, the command behaves like the Affectation command | ||
=====Message box===== | |||
[[Image:macro_message_box.png|border|500px]] | [[Image:macro_message_box.png|border|500px]] | ||
Line 523: | Line 577: | ||
When the command is executed, the box is displayed. A click on one of the buttons closes the message box and sets the Boolean parameter value. | When the command is executed, the box is displayed. A click on one of the buttons closes the message box and sets the Boolean parameter value. | ||
=====Periodic loop===== | |||
[[Image:macro_periodic_loop.png|border|500px]] | [[Image:macro_periodic_loop.png|border|500px]] | ||
Line 529: | Line 583: | ||
Runs a set of commands at each interval of time specified in the "Time lap" parameter. The time lap is specified in seconds, the "Break" command must be used to exit the loop. | Runs a set of commands at each interval of time specified in the "Time lap" parameter. The time lap is specified in seconds, the "Break" command must be used to exit the loop. | ||
=====Set Macro parameter===== | |||
Sets the parameter value of a called macro. This command must be inserted between the "Open macro" and the "Execute macro" commands, inside the body of the "Call Macro" command. | Sets the parameter value of a called macro. This command must be inserted between the "Open macro" and the "Execute macro" commands, inside the body of the "Call Macro" command. | ||
Line 550: | Line 604: | ||
The message generated in the top of the dialog box can be defined in the "command properties". A control is used to edit the parameter value. A click on the OK button changes the parameter value, and closes the dialog box. A click on the Cancel button closes the dialog box without changing parameter value. | The message generated in the top of the dialog box can be defined in the "command properties". A control is used to edit the parameter value. A click on the OK button changes the parameter value, and closes the dialog box. A click on the Cancel button closes the dialog box without changing parameter value. | ||
=====Set Parameter Value===== | |||
[[Image:macro_set_parameter_value.png|border|500px]] | [[Image:macro_set_parameter_value.png|border|500px]] | ||
=====Trace===== | |||
Command used to send a message in the log window. | Command used to send a message in the log window. | ||
Line 563: | Line 617: | ||
"Play sound" is used to play a sound when the message is sent. The host computer must have speakers connected. | "Play sound" is used to play a sound when the message is sent. The host computer must have speakers connected. | ||
=====Wait===== | |||
[[Image: | [[Image:macro_wait.png|border|500px]] | ||
Waits for a given time. The wait time is specified in seconds. | Waits for a given time. The wait time is specified in seconds. | ||
====="While" loop===== | |||
[[Image: | [[Image:macro_while.png|border|500px]] | ||
Runs a set of commands several times until the condition is false. The condition can depend on an event, status value or parameter. The event condition can be "event x occurred" or "event x not occurred". | Runs a set of commands several times until the condition is false. The condition can depend on an event, status value or parameter. The event condition can be "event x occurred" or "event x not occurred". | ||
Line 595: | Line 649: | ||
[[Image:Reports_Tools_Ribbons_116.png|framed|none]] | [[Image:Reports_Tools_Ribbons_116.png|framed|none]] | ||
[[Image:Reports_Tools_Ribbons_117.png| | [[Image:Reports_Tools_Ribbons_117.png|700px|none]] | ||
* '''Advanced alarm: '''This condition is available only when at least one alarm on a double template result has been declared. | * '''Advanced alarm: '''This condition is available only when at least one alarm on a double template result has been declared. | ||
Line 601: | Line 655: | ||
[[Image:Reports_Tools_Ribbons_118.png|framed|none]] | [[Image:Reports_Tools_Ribbons_118.png|framed|none]] | ||
{|border=" | {|border="0" cellspacing="0" cellpadding="4" width="100%" align="center" | ||
| | | | ||
[[Image:Reports_Tools_Ribbons_119.png|framed|none]] | [[Image:Reports_Tools_Ribbons_119.png|framed|none]] | ||
| | | | ||
{|border="2" cellspacing="0" cellpadding="4" width="100%" | {|class="wikitable" style="background:white" border="2" cellspacing="0" cellpadding="4" width="100%" | ||
|'''Operator''' | |'''Operator''' | ||
|'''Test''' | |'''Test''' | ||
Line 708: | Line 762: | ||
| | | | ||
{|border="2" cellspacing="0" cellpadding="4" width="100%" | {|class="wikitable" style="background:white" border="2" cellspacing="0" cellpadding="4" width="100%" | ||
|'''Operator''' | |'''Operator''' | ||
|'''Test''' | |'''Test''' | ||
Line 803: | Line 857: | ||
|}<br clear="all"> | |}<br clear="all"> | ||
====Editor contextual menu==== | |||
=====Setting properties===== | |||
* '''Cut: '''Removes the command selected and copies it to the clipboard. | * '''Cut: '''Removes the command selected and copies it to the clipboard. | ||
* '''Copy: '''Copies the command selected in the clipboard. | * '''Copy: '''Copies the command selected in the clipboard. |
Revision as of 10:46, 7 January 2022
Tutorial
A macro is a powerful automation tool of NVGate allowing to create your own programs from a simple graphic interface, and doesn't require any software development skills.
In this section, we will create a macro that will automatically restart the recording as soon as the measurement is stopped. To do so, add the channels into the recorder.
Creating a new Macro
Go in the "Automation" tab of the NVGate ribbon, and select "New" in the Macro group:
Add a parameter
This will open the Macro editor :
Our macro needs to restart the recording as soon as it had been stopped. The macro needs to loop as long as necessary, and the user must be able to stop the loop when needed. To do so, we will create a boolean parameter to control the loop. The loop will then iterate as long as this parameter is "True", and the user can change it to "False" to stop the loop and the Macro.
To create this parameter, right click on the name of the macro and select "Properties":
Then click on "Add", and define the Boolean parameter "EnableMacro" as follows:
Affectation
In order to control the Macro, we will must be able to change the value of "EnableMacro" from "True" to "False".
This can be done with an "affectation" on the Macro editor. An affectation being an Algorithmic command, it must be add from the "add an Algorithmic command" icon .
To create an affectation, select "End of Macro" and click on the icon. You need to select "End of Macro" because the affectation will come just before this line.
Select "Affectation" in the list and set it up as follows :
You can now change the value of "EnableMacro" by double-clicking on the Affectation command.
While Loop
In order to loop as long as needed, we will use a "while" loop that iterates as long as "EnableMacro" is set on "True".
The while loop is an Algorithmic command, and will be added the same way as the Affectation command. Click on "End of Macro", click on the icon and select "while loop". Then set the loop as follows :
If instruction
Inside the while loop, we need to test if the measurement has been stopped. An IF instruction can be used to perform such logical test. The IF instruction allow you to chose between two different actions to take regarding the current state of an event, or the value of parameter. Here, we will test if the event "Measurement is stopped" occurred.
To add the IF instruction inside the loop, select the "End while", open the Algorithmic list and select "If... Then...". Setup the If test as follows :
Add the Run Command
Now that the If test is setup, we only need to add the "Run" instruction inside the If test to have the macro re-starting the measurement as soon as it has been stopped. However, the "Run" command is not an Algorithmic, but an NVGate command.
To add an NVGate command into the Macro, we will need to use "record off line" or "record on line" options. These icons will allow you to add one or serveral NVGate command in the macro by simply clicking on them. Once you added all the NVGate commands you want, you need to re-click on the "record on line" or "record off line" icon to stop the recording and validate the sequence.
The "record on line" command will add the NVGate command in the macro and execute it at the same time. By example, clicking on and will add the "Run" command in the macro and start the acquisition in NVGate. Clicking on and then will add the "Run" command in the macro, but will not start the acquisition in NVGate.
To add the NVgate "Run" command into our macro, we don't need to actually start the acquisition in NVGate. To add it, select the "End if" line in the macro (because we want to add the "Run" command before this line), click on . Then click on and re-click on to stop the recording of the command :
The complete Macro
The macro is now complete :
You may save it with the floppy-disk icon .
To try it, you can Run the acquisition by clicking on "Run" in NVGate and then start the macro by clicking on the play icon of the macro editor. If you stop the recording, a new one will be automatically restarted by the macro. For on optimised use, set the NVgate save option on "Without name confirmation".
You can stop the macro anytime by using the "pause" option of the macro editor and set the "EnableMacro" parameter on "False".
Launch the Macro
Use the control panel to launch the macro in NVGate.
Execute a .exe in a macro
This allows you to launch an external .exe or .bat. with a macro.
Process:
- Put your .exe in C:\OROS\NVGate data\Links
- click on "record on line buton".
- Select the .exe using the NVGate Link
- stop the "record on line".
Macros group
The macros group is used to create/manage macros that perform automatically recurrent operations.
Manage: Open the macros manager. | |||||||
New: Create a new macro and load it in the macro editor. This menu is disabled if another macro is being edited. | |||||||
Save: Save the macro currently edited. Only available if a macro is being edited. | |||||||
Save as: Save the macro currently edited with a new name. Only available if a macro is being edited. | |||||||
Record: Start recording the user action on the software. Each recorded action is appended to the Macro and will be a visible line in the macro editor.
Prior to start the macro recording user must enter the macro name and the recording mode:
Note: Click on the record button to stop recording the macro. The macro is saved with the name specified in the "Record" dialog.
| |||||||
Pause record: Pause the ongoing macro record. User actions are not yet recorded. Available if macro is being recorded.
Useful to prepare the system for an action to be recorded without filling the editor with unwanted lines. | |||||||
Stop run: Stop the execution of the running macro. Available if macro is running. |
Macros Manager
Display the macros list and the associated hot-keys. A hot-key is a shortcut to run the macro.
Note: the three first hot keys are automatically assigned in the "Macro" menu from the OR38/OR36 Front Panel, labeled as "0", "1" and "2".
- Edit: Edit the macro selected. Available if no macro is being edited, recorded, or executed.
- New: Create a new macro. The new macro is opened in the editor. Available if no macro is being edited, recorded, or executed.
- Delete: Delete the macro selected.
- Run: Run the macro selected. Available if no macro is being executed.
- Properties: Edit macro properties (name, read-only flag, and assigned hot-key). Available if no macro is being edited, recorded, or executed.
- Name: Change the name of the macro.
- Read-only: If the macro is read-only, the macro can be loaded to the macro editor but can’t be modified.
- Hot key: Define a hot-key to run the macro.
- Assigned macro: Macro associated with the hot-key selected in "Hot-key" combo-box. If hot-key selected is already assigned, a message is generated when the window is closed, requesting confirmation of the new assignment.
Macro Editor
Properties: Open a dialog box intended to edit macro properties. | |
Delete : Delete the selected command in the macro tree. If the macro selected contains a set of commands (for example a loop command), a dialog box appears in order to confirm command removal. If removal is confirmed, the command and all commands it contains are deleted.
This command is enabled if the macro is not running and it is not read-only. | |
Run: Run the macro from the current command (indicated by execution pointer) to the next breakpoint. If no breakpoint follows, the execution goes to the end of the macro. Enabled if the macro is not running. | |
Pause: Stop macro execution. The command running is completed, and then execution stops.
This command is enabled when the macro is running only. | |
Step next: Run current command (indicated by execution pointer). This command is enabled when the macro is not running. | |
Reset: If the macro is running, stop the execution, and then set the execution pointer to the first command of the macro. | |
Record on-line: Record commands in the macro. The record on-line mode applies the user actions. The commands corresponding to actions are recorded and inserted in the macro before the selected command. This command is enabled if the macro is not running and it is not read-only. | |
Record off-line: Record commands in the macro. The record off line mode applies the user actions only when the macro will start. The commands corresponding to actions are recorded and inserted in the macro before the selected command. This command is enabled if the macro is not running and it is not read-only. | |
Insert an algorithmic command: Insert an algorithmic command before the selected command. This command is enabled if the macro is not running and it is not read-only. | |
Save: Save the macro. |
Macro properties
Macro properties consist of a set of parameters of different types, which can be used to define macro command properties. This command is enabled if the macro item is selected in the macro tree.
- Add: Defines a new parameter.
- Name: name of the parameter
- Type: type of the parameter. The different types available are
Type | Description |
Boolean | Parameter that can take only 2 values: True or False. This type of parameter is necessary for the MessageBox command to store the answer of the user. The parameter can then be tested in a "If...Then" command. |
File name | Not used |
Float | Parameter that can contain a decimal value (1.2, 1.12e6, -0.025, 5,-12387...). It is useful to store constant value that will be used in the macro for test condition ( If...then, While) or for other command (Wait, SetParamerValue ). |
Integer | Parameter that contains an integer value (5, -1024, 6401). Behavior similar to the float parameter, it can be also used in loop commands ( For loop, periodic loop) |
String | Parameter that contains a string of character. This type of parameter is useful to store constant string and to create string used by NVGate (Measurement name, Report template) or by commands (MessageBox, Trace). Several commands are dedicated to this string parameters ( MakeString, GetCurrentTime...) |
- Value: default value of parameter
- Edit: Open the "Parameter properties" dialog box, which is used to edit the parameter selected in parameters list. It is possible to change the name, the type, or the default value of the parameter. If the parameter is used by one or more macro commands, the type can’t be edited (the "Type" combo-box is disabled).
- Remove: Removes the selected parameter. If the parameter is used by one or more macro commands, the parameter is not removed and an error message is generated.
Algorithmic commands
Affectation
Sets a value to a parameter. The new value can be defined by a parameter.
Break
Used to exit a loop. It can be used inside a "for" loop to stop before the end of the iteration, inside a "while" loop to exit the loop without fulfilling the condition. It is the only way to exit a "Periodic loop".
Call Macro
Calls another macro.
The only parameter is the name of the macro that is called. The body of the command is divided into three steps in order to exchange parameters between the calling macro and the called macro.
Comment
The purpose of this command is to facilitate understanding of the macro. It is used to add a comment line to the body of the macro.
The only parameter is the comment.
"For" loop
Runs a set of commands several times. The number of iterations can be defined by an integer value or by an integer parameter.
Get Current Time
This command retrieves the time and stores it in a string parameter. This string may be use to send a trace, to create a measurement name...
The "Time format" specifies the way in which the time should be written. "Date", "Time" and "Date and Time" use the regional settings of the host computer while the three other formats are fixed formats.
Get Macro Parameter
Gets the value of a parameter of a called macro. This command must be inserted between the "Exit macro" and the "Execute macro" commands, inside the body of the "Call Macro" command.
"Macro parameter" is the parameter of the calling macro that will receive the value of the parameter of the called macro.
"Parameter name" is the name of the parameter in the called macro.
In this example, the command gets the value of the parameter nNumberOfLoop of the macro CheckInput and sets this value to the parameter nCount of the calling macro.
Group
The purpose of this command is to facilitate understanding of the macro. It creates a branch that contains a set of instructions. It has no effect during execution, but it helps to organize the macro and facilitates copying and pasting, since all commands are copied at once.
If…Then…
Runs a set of commands according to a condition. The condition can depend on an event, status value or parameter. The event condition can be "event x occurred" or "event x not occurred".
There are five types of conditions:
- Event: The event can be "Measurement stopped", meaning that the analyzer went from "Running" to "Stopped" or "Measurement started", meaning the analyzer went from "Stopped" to "Running". This condition is used to wait for the end of a measurement, for instance.
- Status: All analyzer statuses can be used for this condition. Depending on the type of status, it is possible to compare its value to a list of possible values or perform a logical test ( ’=’, ’!=’,’<=’,’>=’) with a constant or a parameter.
- Parameter: The macro parameter of can be compared to a constant or to another parameter.
- Simple alarm: This condition is available only when at least one alarm on a simple template result has been declared.
- Alarm results
- Advanced alarm: This condition is available only when at least one alarm on a double template result has been declared.
- Advanced Alarm results
Operator | Test | Condition value for 1 | Condition value for 2 | Condition value for 3 |
= | Above max | False | False | False |
!= | Above max | True | True | True |
= | Cross max | False | False | True |
!= | Cross max | True | True | False |
= | Between min & max | False | False | False |
!= | Between min & max | True | True | True |
= | Cross min | True | False | False |
!= | Cross min | False | True | True |
= | Below min | False | False | False |
!= | Below min | True | True | True |
= | Cross min & max | False | True | False |
!= | Cross min & max | True | False | True |
Operator | Test | Condition value for 1 | Condition value for 2 | Condition value for 3 |
= | Above max | False | False | True |
!= | Above max | True | True | False |
= | Cross max | False | False | False |
!= | Cross max | True | True | True |
= | Between min & max | False | True | False |
!= | Between min & max | True | False | True |
= | Cross min | False | False | False |
!= | Cross min | True | True | True |
= | Below min | True | False | False |
!= | Below min | False | True | True |
= | Cross min & max | False | False | False |
!= | Cross min & max | True | True | True |
Incrementation
The increment command is used to increment the value of a macro parameter with a given offset.
The "Value" group-box allows defining the offset. The offset can be defined by a value or by a parameter of the same type as the parameter incremented.
Available if one or more integer or float parameter is defined.
Make String
Command used to create a string.
"Macro parameter" is the string that is modified. It can only be a String parameter.
"String to add" is the string that is added to the first parameter. It can be a constant or a parameter
"Add to existing string" is a Boolean parameter that indicates if the second parameter replaces or is added to first one. If the value is false, the command behaves like the Affectation command
Message box
Displays a dialog box, which is used to change the value of a Boolean parameter. The box is made up of a message and two buttons ("true" and "false"). It is possible to define the box caption, the message content and the button captions. A click on the "true" button sets the Boolean parameter to "true". A click on the "false" button sets the value to "false".
When the command is executed, the box is displayed. A click on one of the buttons closes the message box and sets the Boolean parameter value.
Periodic loop
Runs a set of commands at each interval of time specified in the "Time lap" parameter. The time lap is specified in seconds, the "Break" command must be used to exit the loop.
Set Macro parameter
Sets the parameter value of a called macro. This command must be inserted between the "Open macro" and the "Execute macro" commands, inside the body of the "Call Macro" command.
"Parameter name" is the name of the parameter in the called macro.
"Parameter value" is the value the parameter must take.
In this example, the command sets the value of the parameter InputNumber of the macro CheckInput to 4.
When the macro is running, a dialog box is displayed, which is used to change the value of a parameter.
The message generated in the top of the dialog box can be defined in the "command properties". A control is used to edit the parameter value. A click on the OK button changes the parameter value, and closes the dialog box. A click on the Cancel button closes the dialog box without changing parameter value.
Set Parameter Value
Trace
Command used to send a message in the log window.
"Message" is the text that is displayed in the log window.
"Play sound" is used to play a sound when the message is sent. The host computer must have speakers connected.
Wait
Waits for a given time. The wait time is specified in seconds.
"While" loop
Runs a set of commands several times until the condition is false. The condition can depend on an event, status value or parameter. The event condition can be "event x occurred" or "event x not occurred".
There are five types of conditions:
- Event: The event can be "Measurement stopped", meaning that the analyzer went from "Running" to "Stopped" or "Measurement started", meaning the analyzer went from "Stopped" to "Running". This condition is used to wait for the end of a measurement, for instance.
- Status: All analyzer statuses can be used for this condition. Depending on the type of status, it is possible to compare its value to a list of possible values or perform a logical test ( ’=’, ’!=’,’<=’,’>=’) with a constant or a parameter.
- Parameter: The macro parameter of can be compared to a constant or to another parameter.
- Simple alarm: This condition is available only when at least one alarm on a simple template result has been declared.
- Advanced alarm: This condition is available only when at least one alarm on a double template result has been declared.
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Setting properties
- Cut: Removes the command selected and copies it to the clipboard.
- Copy: Copies the command selected in the clipboard.
- Paste: Inserts the command stored in the clipboard into the macro. The command will be inserted before the command selected.
If the item selected in the macro tree is an "end of loop" item, the command will be inserted at the end of the loop body.
If the item selected in the macro tree is the "end of macro" item, the command will be inserted at the end of the macro.
- Delete: Deletes the command selected. Available if the item selected in the macro tree is a command item (not "end of loop" or "end of macro item).
- Toggle break point
- If a breakpoint is put on the command selected, this command removes it. Otherwise, it sets a breakpoint for this command. Only available if the item selected is a command item.
Breakpoint has been set. This command is not executed.
During macro execution (see Run button), the execution stops on the first command where a toggle break point is placed.
- Run to: Runs the macro from the current command (indicated by execution pointer) to the selected command, ignoring breakpoints. The selected command is not executed. If the current command is after the selected command, execution goes to the end of the macro, ignoring breakpoints.
- Jump to: Sets execution pointer to the selected command.
- Properties
Edits command properties.