SYMENU System Manager - Internal Macros
Defining an Internal Macro
An internal macro has two different formats depending on where it should be executed from: (1) to be executed from the command prompt, (2) to be executed inside Elliott. The command prompt macro is in free text format. It can be named anything you like, and can be placed in your macro directory, or in any directory you like. On the other hand, the macros to be executed inside of Elliott are subject to certain rules.
Command Prompt Macro
The following is an example of command prompt macro which is a form of Interal Macro. It will print customer numeric edit list for customer number 100 – 200 to the screen and then exit Elliott.
0101 05
“000100”
“000200”
{enter}
{enter}
%S
%O
{close}
Normally, we will name this macro something similar to “CUSNLIST.MAC” and place in the MACRO directory which is either:
\NSI\MACRO or
\ELLIOTT\MACRO
To run this macro, you would use the following command prompt (or setup in short cut):
EL700 02 /F:CUSNLIST.MAC
“EL700” will launch Elliott. “02” will open the Accounts Receivable module. You must specify the module for which the command prompt macro should run. If you wish to run a menu item on the main menu that does not belong to any module, then you should use “00”. For example, the following command will start deferred processing:
EL700 00 0406 %P
Again, “EL700” will open the Elliott application. “00” accesses the Main Menu. “0406” stands for drop down menu 4 (Util-Setup) and menu item 6 (Deferred Processing). Depending on whether the manufacturing module is turned on or not, you may need to use “0306” in the above scenario if you only have accounting and distribution modules turned on. “%P” stands for Alt-P which is the keystroke for the “Process” button. You may want to backup your entire system without leaving any file opened by deferred processing. You can let Windows scheduler start deferred processing at certain hours after the back up is done. In this example, we will execute the internal macro script directly on the command line. The command line is limited to 256 characters, therefore you will have to use a command prompt macro file if your script is longer than the command prompt limitation.
By default, use MAC as an extension for command prompt macros. If you specify a command prompt macro without the extension, the system will assume MAC is the extension. You can also use the macro file from any directory. When you do not specify a directory, it assumes the macro file is in the MACRO directory.
Syntax for Command Prompt Macro
The command prompt macro must begin with the menu path (excluding the module portion) first. In the previous example, “0101” stands for customer file maintenance. “05” stands for customer numeric edit list. Once the cursor is in the actual application, you will use the following scripts:
“000100”
“000200”
{enter}
{enter}
The above corresponds to numeric edit list:
Starting Customer No 000100
Ending Customer No 000200
Print Comment? N (Use enter to accept default)
Any Change? N (Use enter to accept default)
Anything contained in double quotes stands for the data that will be entered into a field followed by the enter key, that is issued automatically. At this moment, the print option window will pop up. The following line will cause the print job to print to screen:
%S - Alt-S stands for “print to screen”
%O - Alt-O stands for the “OK” button
After the print job is sent to the screen, the {close} command will close ELLIOTT and exit.
You may combine each line of text on one line, as long as each command is separated by a space and the maximum length per line does not exceed 255 characters.
Using % Symbol at Command Prompt
One thing you should be aware of when using the “%” symbol at the command prompt is that there is a special meaning associated with this symbol. For example, if you use %XYZ% on the command prompt, it tells the system to substitute the value of environmental variable XYZ with %XYZ%. This may create problems with the following example:
EL700 02 0101 05 “000100” “000200” {enter} {enter} %S %O {close}
The system will interpret “%S %” as an environmental variable. However, since this variable does not exist, it will be substituted with a blank space. The actual command parameters that EL700 receives in this case are:
EL700 02 0101 05 “000100” “000200” {enter} {enter} O {close}
As a result, the command will not work as you would expect. The alternative to this is to use:
EL700 02 0101 05 “000100” “000200” {enter} {enter} %S {enter} {close}
Since %O (OK Button) is the default, you can substitute it with an enter key.
Another alternative is to create a macro file and let the command prompt execute the macro file, instead of using direct keystrokes.
By Pass User ID And Password with Command Prompt Macro
Command Prompt Macro can be a great way to automate certain routine tasks for daily, weekly or monthly process. If you wish to by pass the Elliott login User ID and Password, you could use the environmental variable NWSMDLOG for this purpose. Please refer to this manual for “Installation”, “Special Startup Option”, “Bypass Username, Password and Company Selection” section for more details. For example, you could create a batch file as following:
M:
CD \Elliott7
SET NWSMDLOG=$JOHN$123456$01$
EL700 02 0101 05 “000100” “000200” {enter} {enter} %S {enter} {close}
SET NWSMDLOG=
However, this method may have potential security issue since any users who have access to this BAT file will be able to see the password. Use it at your own discretion. Alternatively, you could ask the user who wish to use this function to start up an Elliott session first. Then the BAT file will be run as the 2nd session which will never prompt for user ID and password. If you choose to go with this way, there’s no rish of exposing the password.
Special Keys for Internal Macro
The Internal Macro supports the following special keystrokes:
{F1} = F1 Key
{F2} = F2 Key
{F3} = F3 Key
{F4} = F4 Key
{F5} = F5 Key
{F6} = F6 Key
{F7} = F7 Key
{F8} = F8 Key
{F9} = F9 Key
{F10} = F10 Key (End)
{ENTER} = Enter Key
~ = Enter Key
;; = Anything on the same line after will be comment
{ESC} = Escape Key
{ESCAPE} = Escape Key
{UP} = Up Arrow Key
{DOWN} = Down Arrow Key
{PGUP} = Page Up Key
{PGDN} = Page Down Key
{CLOSE} = Close ELLIOTT and Exit
{COPY} = Copy the value in the current field to the clipboard
{COPY 0000 9999} = Copy the value in the area as defined from 0000 to 9999 to the clipboard. For example, {COPY 0119 0124} will copy the area from column 1, row 19 to column 1, row 24.
{PASTE} = Paste the value from clipboard to the current field (a enter key will not be issued automatically).
{RUN 999} = Call and run an external macro. “999” is the external macro id.
{WAIT} = Wait for user to enter input before continuing with the script.
These special keystrokes are similar to the external macro, however, not identical. These keystrokes are supported by all Elliott screens except GUI windows. A GUI window refers to note windows, ticklers, help windows, macros, etc. There are, however, two GUI windows that support certain macro keystrokes – the Print Option Window and the Deferred Processing Menu. More GUI windows may be added to the support list in the future.
Print Option Window supports the following macro keys:
%P = Alt-P (Print to printer)
%S = Alt-S (Print to screen)
%D = Alt-D (Print to disk)
%O = Alt-O (OK button)
%C = Alt-C (Cancel button)
{ENTER} = Enter (OK button)
Defer Processing Menu supports the following macro keys:
%P = Alt-P (Process button)
%C = Alt-C (Cancel button in processing screen)
%E = Alt-E (Exit button)
Defining an Internal Macro inside an Application
You can create an Internal Macro from any screen where the Macro button is active. Unlike the External Macro, which applies to the whole screen (help-id) meaning you can execute the external macro anywhere in the screen, the Internal Macro is cursor sensitive. An internal macro that executes successfully if the cursor is at phone number field will not work correctly if the current cursor is at the fax number field. For that reason, when an internal macro is saved, the cursor position for execution is also saved in the macro file heading area. When you try to execute an internal macro, only the internal macro that matches the cursor position will be made available to you.
The following is an example of adding an internal macro in customer file maintenance screen. The macro will be executed from the “Field Number to Change” position:
First, go to Customer File Maintenance and bring up a customer record in change mode. Then, place the cursor on “Field Number to Change.” Next, click the Macro button (Ctrl-A) and choose the Internal tab. You should see the following screen:
Now you can click on the “New” button and the system will prompt you for the name of the macro:
We can enter, for example, “Change Area Code for 909” and confirm OK. After this, you will see the script for the macro show up in your favorite editor (by default, notepad) like the following screen. Currently, there is only the heading area without any script. You will need to enter the following script beneath the [SCRIPT] specification.
“11” means field 11 (Phone Number).
“909” indicates the first three digits of the pone number should be changed to 909. You will need to make sure that you are not in the insert mode when you execute this macro.
The first {enter} is to be execute at “Field Number to Change”.
The second {enter} is to respond to the question “Do you wish to display next screen?” to which the default answer is “N.”
In short, executing this script will change the phone number area code of the current customer to 909 and the screen will be cleared. Save the script in notepad and exit. If you wish to execute this macro, simply go to Customer File Maintenance and bring up a customer. Place the cursor at “Field Number to Change” and then click the macro button (Ctrl-A) and choose the internal tab. You should see the following screen:
Click on the button “Run” to run the macro. If you wish to change the macro script, simply choose on the “Edit” button. The internal macro will be saved in the MACRO directory with a naming convention of:
ARCUSMNT.M99
Where ARCUSMNT is the help-id of the current screen and 99 is a number sequentially assigned from 01 to 99 per help-id. You can have up to 99 internal macros per help-id.
The syntax for an internal macro that is to be executed from inside the application is similar to the command prompt macro with two exceptions:
· Command prompt macros require the startup menu path.
- Command prompt macros do not have a heading area.
A macro executed in one help-id can change itself to another menu item by supplying the menu path. To exit a menu, you may supply the menu number for exit or simply use {esc} in your script. You may also use {close} at the menu level to exit ELLIOTT.