|
Create and run a basic script
|
|
| Start AdmWin, click the tab labeled "SetupBatcher & NTreport".
|
|
|
|
| a) Click file / new section / settings to create an empty [Settings] section.
|
|
|
|
|
|
| b) Put the cursor between the tags "[Settings_Begin]" and "[Settings_End]" and type these lines:
|
|
|
|
| · | When a setting is properly spelled its formatting turns to bold dark blue.
|
| · | "BatchSettings.Delimiter=TAB" means that TAB is used as delimiter in the [Data] section. (The [Data] section is created in below step 5.)
|
| · | "BatchSettings.MarkerCol=4" means that the fourth column in the [Data] section is used for status markers, SetupBatcher uses this column to indicate how far the script has gone. If you try to write anything in this column it will be overwritten when the script starts.
|
| · | (All available settings are listed in the topic settings in the SetupBatcher manual.)
|
| a) Click file / new section / machines to create an empty [Machines] section.
|
|
|
| b) Put the cursor between the tags "[Machines_Begin]" and "[Machines_End]" and type two backslashes and the NetBIOS name of the local machine.
|
| a) Click file / new section / batch.
|
|
|
| b) Put the cursor between the tags "[Batch_Begin]" and "[Batch_End]" and type these lines:
|
|
|
|
|
| · | When a command is properly spelled its formatting turns to bold dark blue.
|
| · | The space character before the DOS command is not mandatory, it just makes the code easier to read. Notice that the tab character can not be used to indent lines, SetupBatcher uses the tab character to separate commands from markers.
|
| · | All commands between "Data.Loop" and "Data.EndLoop" is repeated once for each row in the [Data] section.
|
| · | The "DOS" command can be used to execute any dos command that can be run from the command prompt.
|
| · | (All available commands are listed in the topic commands in the SetupBatcher manual.)
|
| · | "%col1%" and "%col2" are variables that refers to columns in the [Data] section.
|
| Tip: The fastest and easiest way to learn more about a command in a script is to use the quick command help function - example: put the editor cursor on the "DOS" row, then press F1 on the keyboard to open the Admwin help file and display DOS command reference.
|
| a) Click file / new section / data.
|
|
|
| b) Put the cursor between the tags "[Data_Begin]" and "[Data_End]" and type these lines:
|
| · | Remember the above "BatchSettings.Delimiter=TAB" setting? It corresponds to the <tab> characters between data columns. It is possible to use other delimiters by changing this setting; Example: change to "BatchSettings.Delimiter=;" and "world;Hello" / "weather;Nice".
|
| · | Why <tab> in most examples then? Most spreadsheets like Excel etc. uses the tab character when data is transferred through the clipboard; by using the tab character it possible to copy data directly between the SetupBatcher [data] section and many other applications.
|
| · | There is one problem though with using tabs; like spaces they are invisible. Fortunately SetupBatcher offers two ways to see tabs:
|
| 1. | Click options, under General / "SetupBatcher / NTreport editor" check "Show control characters" - each tab is displayed as ">>".
|
| 2. | Click data / "show column index" to see column numbers. The drawback with this method is that data / "hide column index" must be clicked to hide the index before starting the job.
|
| The finished script should now look like this:
|
|
|
|
|
|
| Click the green triangle button or press CTRL+R on the keyboard to start the script.
|
|
|
| Result:
|
|
|
|
|
|
|
| Press CTRL+S on the keyboard and save as c:\hello world.cnu. The script will be used in the tutorial run a script from the command line.
|