Batch Editor
This functionality allows to modify and to add actions in a Batch File. To get general information, see Batch Processing & Batch Files.
In a Batch run, click Open editor to access the Batch editor or from the Batch files Explorer, select a batch file and do a right click.
Interface
The main display of the batch file has five columns, and represents the XML file in tree form:
-
Parameter: Usually the XML tag name or the key attribute of a task <param> element. Attributes of batch file commands (loops, if/elseif conditions, variable/arrays etc.) are also displayed in this column, for example
- for i from 1 to 10
- foreach elt in my_array
- variable, string: my_variable
Multi-line text elements, usually comments or python code, are shown in read-only mode in the ‘Parameter’ column, with an editor window popping up when clicked on. For python code (<python> elements, or the relevant SCRIPT elements in a Calculator task), syntax highlighting will be activated.
- Auto: This column is accessible when an in-task XML parameter has an automatic attribute. The value can be either “yes” or “no” (double-click to switch).
- Project Variable: This column says whether an in-task parameter value is a project variable, i.e. it needs to be enclosed in a tag <variable>, <macroVar>, or <vector>. Double-click to cycle through the options, or right-click to choose.
- Value: This column corresponds to the value of the parameter.
- Macro Index: This column is accessible when the project variable is either a macro variable or a compound variable, and is either the macro index or vector component.
- Click
Attach / Detach from Workspace to attach / detach the Batch editor to / from the global interface of Isatis.neo.
- Click
Open to open a file selector and select an existing batch file.
- Click
Save to save modifications in the current batch file.
- Click
Save as to save modifications in a new batch file.
- Click
Open Batch Run to open the batch runner. Opening this runner allows you to see the different tasks recorded into the batch file. You are able to run each of them separately or a selected sequence.
Actions
The following actions are applied on existing elements. Their availability depends on whether the currently selected line(s) are inside a task, or outside. In this context, the <task> item itself is considered “outside” the task; it is part of the outline of the batch file. If the current selection includes lines both inside and outside a task, then all editing buttons will be disabled. The selection of lines is synchronized between the Batch run and the Batch editor in order to easily edit a non-working task parametrization and to run it again after modifications.
- Click
Cut to cut the selected task(s) and element(s).
-
Click
Copy to copy the selected task(s) and element(s).
You can also copy the XML structure of a selection inside a task via the context menu and overwrite a previous XML structure when pasting.
Pasting will then replace the previous structure with the copied one. The “normal” copy-paste from inside a task requires that all the parameter names are the same in both the copied selection and in the selection being pasted over. It now allows for structural changes with a warning.
-
Click
Paste to paste the task(s) and element(s) previously copied.
Outside a task, copy-paste is relatively straightforward. If a task item is part of the copied selection, then the entirety of the task is copied. However, it is possible to copy only part of a loop or if/else branch. i.e., selecting just a <for> item and copying will only copy the <for>, not all tasks enclosed by the for loop.
Pasted elements will go after the selected item, or at the start of the batch file if no items are selected. If the selected item is a loop (similarly for if/else branches), then there is an option to paste the items nested inside the loop, or to paste after the end of the loop.
Inside a task, pasting is only available if the selected parameter names match the parameter names in the clipboard. So, for example, you can copy consecutive <path>, <file>, <table> elements from one task; then select consecutive <path>, <file>, <table> from another task, and paste to replace the values. This restriction is to avoid breaking the expected structure of the task fiche.
- Click
Undo to undo the last modification.
- Click
Redo to redo the last modification.
-
Click
Find or type Ctrl-F to bring up a Find-Replace widget across the bottom of the window:
Searches can be on task parameter names and/or on parameter values. Parameter values can be replaced. Clicking ‘Replace’ will do the replace on the currently selected line and then move to the next found item containing the search string.
- Check the Match case option to do a case sensitive comparison (the string which you are comparing should exactly be the same as a string which is to be compared).
- Check the In selection option to apply the search only to the highlighted lines.
-
Check the Use regular expressions option to define a pattern you are searching rather than an exact string. You can search strings beginning with «selection», continuing with anything else and ending by «mesh», by using «selection.*mesh». The main expressions are:
For more details, you can also refer to this website.
Note: Find-replace also works when replacing empty values as long as there is a non-empty parameter being searched for. A potential use case can be, if you have recorded a task referring to a data table which is not inside a folder (directly reachable at a first level), and then you move it in a folder, you will be able to replace easily all the empty ‘path’ fields by the name of the new folder.
Click ESC to hide the Find-Replace widget and Ctrl-K to block comment/uncomment.
- Click
Outline View to shrink all the expanded tasks and elements.
- Select some text and modify the Font size. The font size modification is stored for the duration of the Isatis.neo session.
-
Click
to expand the task and display the complete set of parameters.
-
When a task is expanded, click
to hide the complete set of parameters of the task. Only its title is displayed.
- When a bulletin is expanded, double-click to edit a parameter if you wish to modify the entered value.
- Click
Delete to remove the selected action(s). If it is inside a task, and the selected actions are not a numbered ITEM_n-style list, then a confirmation is asked first. If the deleted action is a loop or if/else branch element, then the child actions remain present.
- Click
Duplicate to duplicate the selected action. It is available outside tasks, and inside numbered ITEM_n task parameter lists.
-
Use the arrows to move the selected task one task backward / forward. It is available if one item is selected, either outside a task or in a numbered ITEM_n list (not the first/last item in a numbered list). It moves the element up/down one row, renumbering ITEM_n parameters if relevant. Outside a task, it may move into a loop or if/else branch while staying displayed on the same row.
Batch elements
The following buttons create new elements of a batch file. Most of them are only available if the current selection is outside a task, and may only be available if one or zero items are selected. New items will be created immediately after the currently-selected item, or at the start of the batch file if no items are currently selected.
Note: For more details about the different elements available in a batch file, see the Batch Processing & Batch Files page.
-
Click
Variable to define a new variable. A dialog pops up to set the variable name, type (text, integer or float), and value. The item may be double-clicked in the parameter column later to change the name or type.
-
Click
Array to create a new variable which is defined by a list of values. A dialog pops up to set the name, type (text, integer or float), and values. Values can be entered through a list (whose values are separated with a comma by default) or having one entry per line (<value> elements in XML, displayed as numbered indices in the editor).
-
Click
Python to create a <python> element. If the file is left blank, then a pop-up editor window will appear.
-
In the Python editors (batch python editors or the Calculator window), whitespace characters, in particular tabs and spaces for the indentation, can be visualized via the context menu or using the Ctrl+J shortcut.
-
A Python script can be directly open from the batch editor via a right-click to open the context menu.
-
-
Click
Include if you wish to include an existing batch file in the current one.
Opening an included file is accessible by right-clicking for a context menu.
-
Click
Redirect to send the content of the Messages area in a specified file.
-
Click the folder icon
to pop up a window file selector enabling you to define the Output file where the messages will be stored. By default, messages are stored in a log file (suffixed with the date and hour of the day log_YYYYMMDD_hhmm.html) contained in the public directory of the project. Click
to retrieve the default path and file name.
Two modes are available:
- Overwrite: the previous content of the file will be erased and new messages only will be visible.
- Append (default mode): if the file is not empty, new messages will be added below.
-
Select Stop redirection to stop sending messages in the file. Otherwise, all the content of the messages window will be sent in the file until you ask for a new redirection, you stop it or the batch finishes.
When running a redirection, a clickable link of the output file is provided in the Messages area to directly open it and see its content.
-
- Click
Message and enter your message in the Value column. This message will be printed in the Messages area when running the batch file.
- Click
Comment and enter your comment in the Value column. This comment will be displayed in the batch run if the Show Comments option has been activated. If you want to have a comment on several lines, you have to start each line with <comment> element.
- Click
Xml to create an XML comment. It is available both inside and outside tasks.
-
Outside a task, click
For to create a for loop around the selected items. Inside a task, it will add a repeat=”for” attribute to a single selected item. In both cases, a dialog pops up to enter the parameters, which can be edited later by double-clicking on the item:
- In the Index (looping variable) box, enter the character string used to name the index of the loop.
- In the Start box, enter a value for the first index in the loop.
- In the End box, enter a value for the last index of the loop.
- In the Step box, enter a value for the step between two indices of the loop. This field is optional. If you leave it empty, the index will be incremented by 1.
- In the Stop condition box, enter a condition (a Python expression) to stop the loop. This field is optional. If the stop condition is evaluated to false, then the index variable is unset and execution goes to next element after the ending </for>.
To remove a repeat=”for”, right-click on the item parameter.
-
As above, click
Foreach to make a foreach loop or repeat=”foreach”.
-
Click
If to add a condition. The Condition is a Python expression returning a boolean value. If the test is successful (i.e. the boolean expression returns ”true”), the tasks following the condition and before the </if> will be executed.
-
Elseif: This element is available if the currently selected item is inside an <if> block. It puts the selected item and subsequent items inside an <elseif> block. The subsequent items include all items in the current <if> block until either the block ends, or an <elseif> or <else> element is encountered.
-
Else: This element is available if the currently selected item is inside an <if> block and after the last <elseif>. It puts the selected item and all subsequent items in the block into an <else> block.
-
Disable: This action is available through a right-click when selecting one or several lines of the batch file.
- Disable this line only is available on ‘for’, ‘foreach’, and ‘group’ lines. It ignores the element but process its child elements.
- Disable block is always available (also when selecting several lines). It skips processing the element and not process its children too.
- Enable is available when selecting elements which have been disabled previously.
Disabled parts of the batch file will be shown with a grey background in the batch editor, and will not be seen in the Batch Run window.
Shortcuts
Some useful keyboard shortcuts:
- Ctrl + O to open a file.
- Ctrl + S to save.
- Ctrl + F to find.
- Del to delete a line.
- Ctrl + A to select all.
- Ctrl + C to copy.
- Ctrl + X to cut.
- Ctrl + V to paste.
- Ctrl + Z to undo.
- Ctrl + Y to redo.