Macro Server - Info

Macro Server - Info

What Is Macro Server


  1. Central Management of Macros
  2. Macros are stored in the database
  3. Deployed as a Web Service under IIS
  4. Visual Access Controls are Applied to Macros
  5. Provides Extensions to VBScript Environment
    1. SQL Queries
    2. Common VBScript Function Library
  6. Has a Basic Script Editor Included



Server Side – Macro Server

  1. Macro Server
  2. What it does:
  3. Central Deployment
  4. Allows test in test database





Client Side – Loader

  1. Loader
    1. What it does
      1. Bridges Visual VB Script to dotNet
      2. COM interop for dotNet
    2. Synergy No Touch deployment (VE Scripts)
      1. Deploy using Domain Policy with Active Directory
      2. All other dotNet components are pulled to the client from the macro server by Loader




Client Side – Macro Net

  1. Macro Net
    1. What it does
      1. Interaction with the Visual database
      2. Retrieve scripts from the Visual database
      3. Execute SQL queries using the user’s credentials
        1. No passwords in scripts



Client Side – “Macro Stub” Script


Notes
Option Explicit
dim lib, scriptName, serverName
'_______****User Entry Required****________
'Define Script and Server

scriptName = "DistOrd"  ' Distributed Order SET THE SCRIPT NAME HERE 
serverName = "SRISalesDemo“ 
< SET THE WEB SERVER HOSTNAME HERE 
'_____________________________________

set lib = createobject("VTG.Loader.Managed") 
 < LOADER (CLIENT COMPONENT)
lib.ServerUrl = "http://"  & serverName & "/SRIMacroServer" 
< WEB SERVICE
dim util
lib.ActivateObject "util","VTG.Macro.Net.dll","VTG.Macro.Net.Lib“ 
< MACRO NET PREP
set util = lib.GetObject ("util") 
< MACRO NET INSTANTIATED IN VBSCRIPT ENVIRON
util.ServerURL = lib.ServerURL 
< USE THE SAME WEB SERVER 
executeglobal util.Script(scriptName) 
< THE MAGIC HAPPENS HERE



Macro Editor

Storing Script in the database
      Use the tool - REMOVE ALL TEXT TO DELETE




VB Script – SQL Queries


  1. Three SQL Query Functions
    1. ExecuteScalar
      1. Use for Select when expecting a single value
    2. Execute Query
      1. Use for SELECT when Expecting an Array of Data
    3. ExecuteNonQuery
      1. Use for Stored Procedures, INSERT, UPDATE, and DELETE
  2. These are Methods on the UTIL Object
    1. They Connect with the Users DB Credentials


ExecuteScalar

Returns one piece of data

Notes

'ExecuteScalar Test

util.CommandType = "Text"
util.Sql = "Select COUNT(*) FROM PART WHERE DESCRIPTION IS NULL"
MSGBOX "Scalar test " & util.ExecuteScalar




ExecuteQuery 

Returns “array” data
Notes

'ExecuteQuery Test

util.Sql = "Select ID, DESCRIPTION, UNIT_PRICE FROM PART WHERE ID LIKE ‘M%'"

objArr = util.ExecuteQuery

msgbox ubound(objArr ,1) & " Rows, " & ubound(objArr ,2) & " Columns"

'Loop the Array

For row = 0 to ubound(objArr ,1)

  IF MSGBOX ("PartID: " & objArr( row,0 ) & " Description: " & objArr(row,1) & _  " Unit Price:<" & objArr(row,2) & ">",VbOkCancel) = VbCancel THEN          EXIT FOR

  END IF


ExecuteNonQuery

 Returns Status

Notes
'ExecuteNonQuery Test
util.Sql = “UPDATE PART SET FABRICATED = ‘Y’ WHERE ID LIKE ‘MXZ%'"
status = util.ExecuteNonQuery
Msgbox “Udated “ & status & “ Rows.”



    • Related Articles

    • Macro Server - Release Notes

      v1100.1000 2025.01.24 - Upgrade to .NET Framework 4.8 v1000.1007 - Resolve Invalid or Expired Credentials Key Exception when calling Client ExecuteNonQuery(), ExecuteQuery() or ExecuteScalar() directly from Macro before any other methods - Server, ...
    • MacroServer Tools

      Check MacroServer Version Attached is a zipfile with 2 files TEST.xml and VMPRTMNT_Test.vms Login to the Macroeditor [Appstore]:\Visual\Localapps\webservices\SRIMacroServer\Tools Load the TEST.xml using MacroEditor File>Import>SRIScript Select the ...
    • Common Macro Errors

      This KB will show the most common Issues and solutions to Errors when running Macros in Visual Red Exclamation Icon and blank box when running a Macro Solution 1 Make Sure the Visual Mfg VSCRIPT.dll is registered Open CMD prompt using Run as ...
    • MacroServer - Field / Form Level Security

      Create a macro that will prevent users from changing specific field level Part Master Data Create OnSaveMacro under Part Maintenance Login to Macro editor on macroserver Create Macro Script with Logic Configure Permnissions Under Visual Program ...
    • Synergy uniPoint Connector - User Guide

      Installation You can find the installation document for Synergy uniPoint Connector here. How to Use Overview Synergy uniPoint Connector can be used in the following Visual windows: Customer Maintenance Customer Order Entry Part Maintenance Vendor ...