WM-Synergy Macro Editor
This is rich client user interface, which allows for the maintenance of Synergy Created Macros that support the Infor Visual ERP Manufacturing, (VE), Visual Basic Scripts (VBScript) typically used in a VE Macro situation.

Each script is designed to execute and talk through the Synergy
Macro Server. This collection of scripts is centrally stored within the VE
database in a customized schema that would be installed during the Synergy
Macro Server installation process.
Features are to include the following:
· VB Script Keyword Highlighting
a. Ability
to add keywords to enhance the Editor session
· Centralized Listing of installed Macros
a. SRI Macros
b. Visual ERP Macros
· Import / Export Options
· VE Security “Seed” Record
· Multi DB & Multi Macro Server Support
· Macro Server history
· “Stacked” Undo & Redo history
· MDI environment
· Ability to add security to Fields that are part
of a MACRO security call.
· Ability to change the size of text in a given environment window. <Ctrl mouse wheel up/down>
· The Macro Editor now supports Visual ERP 7 Field Level Security.
Login
You are required to identify 4 pieces of
information:
o Server URL – Macro Server Location
§ The server URL is the HTTP Path to ServerLib.asmx
§ http://servername/srimacroserver/serverlib.asmx or https://servername/srimacroserver/serverlib.asmx
o Database – Visual ERP database Name
o User Name – Visual ERP User Name
o Password – Visual ERP Password
Login can be accessed from the Connect icon on
the screen or Ctrl + Shift + L
Note:
The Server may be https:// or http://
Once you enter your required log in information, the screen will let you know that it is processing.

A listing
of previous Macro Server URLs shall display
A listing of previous Macro Server URLs shall
display in the drop down list, and will also retain the Last 6 connections in
the File – Connection Menu
Export Options:
· SRI Script – Preferred
· For the selected script name, you will be able to
export the information to a formatted xml file.
· Oracle
o An oracle specific table direct insert sql
statement will be generated.
· SqlServer
o A SqlServer specific table direct insert sql
statement will be generated.
· RTF
o The body of or script is saved to file as show in
the editor.
· Full Database Export
o A menu item with the same name of the DB will
export all the scripts for that database in a formatted xml file.
Import Options:
· SRI Script
· This format is from an Export – SRI Script,
either a single Script or Full Database Export. Importing a script will insert or update based on the Macro Script name
VE Security
An option to “Seed” Visual with a program
security record is added under the Security Menu.
Running this for a selected macro script shall
add to Visuals Program Security.
· The Macro Script shall be written as the Program
ID, and the Description is the Menu String only for the first entry. Changing
the Macro Description, and re-running the security function has not effect.
· By default ALL users have permission to new entries.
· Visual security shall then be controlled using
the VE security tools.
As shown above, you have the ability to view all values for
a given program/macro as stored within the Visual ERP System.
Setup Infor Visual ERP
Add Macro Name to Visual Security
APPLICATION! This menu item
allows the programmer to add the macro name to the Visual ERP Macro
System. This can then be used to add
security to the macro to prevent un-authorized users from executing the
code. This is but one level of security
that can be placed on the developers macro code.
The current list is as follows:
Security at the Macro Level Security
on the Macro as a separate entity
Security at the Program ID and
Macro Level Security on the
Macro as a component of the Visual ERP Code. Ex PROGRAM_ID: VMSHPENT COMPONENT: (macro name here)
Security that Program ID and
Field Level Security of fields within the
Macro can be done via the Visual ERP Code (new in Visual 7). This helps to better delineate how to perform
the security layers of a particular macro and tabs/fields within the Macro.
Visual ERP Employee Security This menu item picks up where Visual ERP
left out. Yes, it allows one to setup
security Groups and apply Employees to that Group. Any time a change is made to the security
model, it is automatically applied to the employee’s of the given group. This makes the job of Securing Visual ERP
painless.
Unlock Visual ERP .vms files: As a developer, one wants to be able to
edit the Infor Visual ERP Manufacturing Macros, however, this are typically in
a ‘Locked’ status in order to prevent end users from modifying the code. For the developer, there is the Unlock
Visual ERP .vms files menu selection. This runs a simply .batch file that can be easily configured to match
your in-house configuration for the location of the .vms files.
Retrieve Visual ERP .vms files does just that. It will run a batch file
that will copy all of the .vms files from the source to a specified directory
on the developers computer for backup, reference, etc. This batch file is editable to match the
in-house configuration and to specify the default location of where to copy the
files to on the developer machine.
Creating a new Macro
Pressing File->New will generate the following in the
Editor panel .

Default Synergy Interface for Visual ERP Macros
The following snippet shows
- Option Explicit
- dim lib, scriptName, serverName
- '_______****User Entry Required****________
- 'Define Script and Server
- scriptName = "Synergy Macro Name" ' My Synergy Macro Name here
- serverName = "your server name"
- '_____________________________________
- set lib = createobject("VTG.Loader.Managed")
- lib.ServerUrl = "http://" & serverName & "/SRIMacroServer"
- dim util
- lib.ActivateObject "util","VTG.Macro.Net.dll","VTG.Macro.Net.Lib"
- set util = lib.GetObject ("util")
- util.ServerURL = lib.ServerURL
- executeglobal util.Script(scriptName)
Adding Debug Script
The following is a sample of VbScript error handling. It is important to note that when using On Error Resume Next, that it be turned off in subsequent code with On Error GoTo 0
On Error Resume Next
Dim fso, file
Set fso = CreateObject("Scripting.FileSystemObject")
Set file = fso.OpenTextFile("nonexistent.txt", 1)
If Err.Number <> 0 Then
WScript.Echo "Error Details:"
WScript.Echo "Number: " & Err.Number
WScript.Echo "Description: " & Err.Description
WScript.Echo "Source: " & Err.Source
Err.Clear
Else
file.Close
End If
The Toolbar
One can save the macro at any time by pressing the icon.
One can print the macro at any time by pressing the
icon.
One can UnDo changes by pressing the
icon.
One can ReDo changes by pressing the icon.
One can Comment out sections of code by pressing the
icon.
One can UnComment sections of code by pressing the
icon.
One can indent code by pressing the
icon.
One can unindent code by pressing the
icon.
One can Cut, Copy, Paste per normal windows shortcut keys.
Searching
There are (2) methods of Search:
- Search for text against all macros
- Search for text in the current document
To Search for text against all macros use the Edit->Search Macros


This will then display the names of all macros in which the
text phrase can be found.
To Search for Text within the current VBScript frame use the toolbar text area:

This is a standard windows type search engine and will
highlight the word(s) that are to be found.
Adding vbscript syntax
We try our best to have all vbscript 'standard' language to be highlighted in the editor frame, however, if you find that there are some syntax's that you would like highlighted you can easily add them.
In the Program directory is a folder named Language
Make a copy of the
vbscript.xmlEdit
vbscript.xml (NotePad++ is a preferred editor)

Simply add a new KeyWord to this file and save the file.
With the next editor session, that word should now be highlighted.
Infor Visual ERP Macros
(Copied from Visual ERP Help File)
Macros can be read from the workstation or from the database. Use the Store Macros in Database check box on the Defaults tab in Application Global Maintenance to determine from where macros are read and where any new macros are stored. If the check box is selected, then all macros are read from the database, and any macros added after the check box is selected are stored in the database. If the check box is cleared, then all macros are read from the workstation, and any macros added after the check box is selected are stored on the workstation. You cannot read certain macros from the database and other macros from the workstation.
Macros function in the same way regardless of where they are stored. The decision to store macros in the database or on individual workstations depends on how your company uses macros. If your macros are specific to users, then it may be beneficial to store the macros in the database. When the macros are stored in the database, users can access their macros regardless of the workstation they use to sign into VISUAL. If your macros are specific to particular functions, and only certain workstations are used to perform those functions, then it may be beneficial to store the macros on the workstation. When macros are stored on the workstation, any user who signs into the workstation can use the macros.
A primary benefit of storing macros in the database is tighter control over the macros a user can run. For macros stored in the database, users can run only those macros they have created themselves and any macros that the SYSADM user has created and assigned to them.
This table shows some of the key differences between storing macros on work stations and storing macros in the database:
| Macros Stored on Work Station | Macros Stored in Database |
Who can access macros? | Any user who can sign into Visual on a work station can access the macros saved on the work station | Users can access macros they created themselves or macros the SYSADM user has assigned to their profiles in Security Maintenance.
|
| Yes. You can copy and paste macros from one work station to another work station.
| Yes. Since the macros are in the database, users can access their macros from any work station.
|
Can I use a User Toolbar button to launch a macro? | Yes | Yes |
Can I share macros with other users? | Yes. You can send users your .vms files.
| Yes. If the SYSADM user created the macros, the macros can be assigned to multiple users through profiles.
|
Types of Macros
You can create two types of macros: macros that run automatically based on an event and macros that you run manually.
Macros can be automatically run based on these events:
OnSave – The OnSave macro is run before the ability to save information has been validated.
OnAfterSave – The OnAfterSave macro is run after the user saves the record.
OnLoad – The OnLoad macro is run when the user opens an existing record.
OnNew – The OnNew macro is run when the user clears a record (clears the window ready for a new record) by clicking the New toolbar button.
OnDelete – The OnDelete macro is run when the ability to delete information has been validated, but before the deletion actually occurs. You cannot use this macro in the Manufacturing Window.
OnAfterDelete – The OnAfterDelete macro is run after information has been deleted from the database, but before the window has been cleared. You cannot use this macro in the Manufacturing Window.
SaveProcess – The SaveProcess macro is used in conjunction with Performance Leadtime. The macro is run when you save a record.
To create a macro based on an event, use the event name as the macro name.
For example, to create an OnNew macro, specify OnNew in the Macro Name field. When the event occurs, the macro is run.
To create a macro that you run manually, specify any name as the macro name. To run the macro, select it from the Macros menu.
Working with Macros Stored on the WorkStation
When macros are stored on the workstation, they are saved as vms files in the same directory as your VISUAL executables. The file name uses this pattern:
[VM Executable]_[Macro Name].vms.
For example, if you created a macro named SELLPRICE in Part Maintenance, then the macro file name is:
VMPRTMNT_SELLPRICE.vms.
Macros stored on a workstation are available only at that workstation. You can share the files with other users. When other users copy macros to their workstations, they are available for selection in the associated VISUAL executable.
Setting Up Visual to Store Macros
To set up VISUAL to store macros on workstations:
- Select Admin, Application Global Maintenance.
- Click the Defaults tab.
- In the Macros section, clear the Store Macros in Database check box. When you clear this check box, any macros you create are stored on the workstation where you created them. When you run macros from a VISUAL executable, the macros stored on the workstation are run. Any macros stored in the database are ignored.
- Click Save.
Deleting Macros
If you store macros on workstations, any user can delete a macro at any time. Use caution when deleting a macro from a workstation. If you delete a macro from a workstation, it is deleted for all users of that workstation.
If you store macros in the database, you can delete macros that you created. You cannot delete macros created by the SYSADM user that have been assigned to your profile.
To delete a macro:
- From an application that supports macros, select Macros, Edit.
- In the Macro Name field, specify the macro to delete.
- Click Delete.
Copying Macros from the Database to a WorkStation
If you previously stored macros in the database, but you now store macros on workstations, you can copy the macros from the database to the workstation. When you copy macros from the database to a workstation, the macros are not deleted from the database. While the macros are still stored in the database, the database macros are no longer used.
Before you begin this procedure, make sure that the Store Macros in Database check box on the Defaults tab in Application Global Maintenance is cleared. See Setting Up VISUAL to Store Macros on Workstations.
When macros are saved to the database, they are saved by user ID. When you copy macros from the database to the workstation, only the macros created by the currently signed in user are copied. Therefore, to copy all macros from the database to a workstation, each user who created macros should perform this procedure.
To copy macros from the database to a workstation:
- On the workstation, sign into VISUAL.
- Select Admin, Load Macros. In the title bar of the dialog, Copy Macros to File System is displayed. All macros currently on the workstation and currently stored in the database are displayed. An arrow is displayed in the row header of the macros that are going to be copied to the workstation. For each macro that is to be copied, this information is displayed:
- File Name – The file path and file name of the new vms file is displayed.
- Program – The executable file name of the VISUAL program where the macro was created is displayed.
- Name – The name of the macro is displayed.
- Macro – The macro code is displayed.
- Click Save. The macro files are generated and saved to the workstation. The macros are not removed from the database.
If other users created macros in the database that should be stored on the workstation, these users must sign into the workstation and perform this procedure.
For a WorkStation Macro
If other users created macros in the database that should be stored on the workstation, these users must sign into the workstation and perform this procedure.
- Select Admin, Toolbar Maintenance.
- Click Insert.
- Specify this information:
- Program Name – Specify the name of the program where the macro is used.
- Toolbar ID – Specify the ID of the toolbar where you are adding the macro button.
- Position – Specify where on the toolbar to place the macro button. You can specify a value from 1 to 20.
- Bitmap – Specify the bitmap to use as the toolbar button.
- Tool Tip – Specify the text that is displayed when you place your mouse over the toolbar button.
- Execute Command – Double-click the browse button to select the macro file. To filter the files for macro files only, specify Macro Files in the Files of type field. When you select a macro, make sure you select a macro that can be run in the program you specified in the Program Name field. For example, if you specified Part Maintenance in the Program Name field, make sure you select a macro that begins with VMPRTMNT.
- Use Key in Cmd Line – Clear this check box.
- Add Entry to Toolbar – This check box is displayed for the SYSADM user only. To share this toolbar button with all users, select this check box. To retain this toolbar button for the SYSADM's use only, clear this check box.
- Click Save.
For a Database Macro
If you use User Toolbars, you can add a button that launches a macro stored in your database. You can add toolbar buttons only for macros you manually run. You cannot add a toolbar button for macros that are run automatically based on an event. See Types of Macros.
To add a user toolbar button for a database macro:
- Select Admin, Toolbar Maintenance.
- Click Insert.
- Specify this information:
- Program Name – Specify the name of the program where the macro is used.
- Toolbar ID – Specify the ID of the toolbar where you are adding the macro button.
- Position – Specify where on the toolbar to place the macro button. You can specify a value from 1 to 20.
- Bitmap – Specify the bitmap to use as the toolbar button.
- Tool Tip – Specify the text that is displayed when you place your mouse over the toolbar button.
- Execute Command – Leave this field blank.
- Execute Macro in DB – Double-click the browse button and select the macro to associate with the toolbar. Only macros that can be run in the program specified in the Program Name field are displayed. Select a manual macro. If you select a macro that is automatically run based on an event, this message is displayed when you save the toolbar: Standard macros are not allowed.
- Use Key in Cmd Line – Clear this check box.
- Add Entry to Toolbar – This check box is displayed for the SYSADM user only. To share this toolbar button with all users, select this check box. To retain this toolbar button for the SYSADM's use only, clear this check box. If you specified a shared macro in the Execute Macro in DB field, then you may also want to share the toolbar button for the macro.
- Click Save.
(Copied from Visual ERP Help File)
Use the Program Security tab to set permissions
on individual applications. You can give users full access, read-only access, or deny access to the
program. In some cases, you can grant or deny access to individual program
components, such as tabs and menu functions. In other cases, you can grant full
access or read-only access to certain program fields.
To specify program security settings:
- Verify that the user ID you want to use is displayed in the User ID field.
- Click the Program tab.
- Specify which executables you would like the user to access. The system
provides the name of the application as it appears in the VISUAL menus and
the program ID of the application. The program ID is the actual file name
of the executable. In the Access column for each program ID, specify one
of the following:
Yes – The user has full access to the executable, unless you
have limited access to the executable’s components or field.
Read Only – The user can view information in the
executable, but cannot create new records or edit existing records.
No – The user has no access to the executable.
- You can set Profile String options for the Manufacturing Window, Purchase Order Entry, and
Purchase Requisition Entry. When you select one of these programs in the
Program Security table, the system activates the Set Profile options button. Click the Set Profile Options button to
set up the following:
Manufacturing Window – The
Manufacturing Window executable controls three separate functions: the Quotes,
Work Orders, and Engineering Masters. You can choose which of these
functions the user can
access. Click the drop-down button and select Yes, Read Only, or No.
If you specify the same setting for
all three functions, the system changes the Access column to match.
Purchase Order Entry – You can
specify a ceiling amount for the user.
The user will not be able
to save a purchase order if the total of the purchase order exceeds the limit
you set for the user.
Purchase Requisition Entry – You can
specify a ceiling amount for the user.
The user will not be able
to save a purchase requisition if the total of the purchase order exceeds the
limit you set for the user.
- If the Component column contains “Yes” or “No,” you can
control access to specific program components such as tabs and menu
functions. If the Component column contains “Yes,” then the default
component settings have been changed. If the Component column contains
“No,” then the default component settings have not been changed. For more
information on the program components for which you can define security settings, refer to Program Component Security Settings.
- If the Field column contains “Yes or “No,” you can
control access to specific program fields. If the Field column contains
“Yes,” then the default field settings have been changed. If the Field
column contains “No,” then the default field settings have not been
changed. For more information on the program fields for which you can
define security settings, refer to Program Field Security Settings.
- When you are finished defining security settings, click Save.
The changes to application user permissions take effect the
next time the user opens
the program to which you have changed that user’s permission. For example, if
you have changed permissions for user “Bob” for Part Maintenance and Bob has Part Maintenance open, those permissions
do not take effect until Bob closes Part Maintenance and starts it again.