VBScript examples show you how to manage scripts on systems that have multiple Mentor PCB software installs.
If you are running a 32-bit install on a 64-bit machine, ensure that you use 32-bit script hosts in SysWoW64.
To start a 32-bit command prompt, do one of the following, depending on your operating system:
Windows 7—Choose Start > Run, type %windir%\SysWoW64\cmd.exe, then click OK.
Windows 8—Press the <Windows>-R key combination, type %windir%\SysWoW64\cmd.exe, then click OK.
Dim app
' Create an instance of the Layout application (last install).
Set app = CreateObject("PowerPCB.Application")
Dim app
' Create an instance of the Layout application (for PADS VX.2.5 install).
Set app = CreateObject("PowerPCB.Application.78")
' Get the environment of a specific SDD_HOME
Dim dllApp
Set dllApp =
CreateObject("MGCPCBReleaseEnvironmentlib.MGCPCBReleaseEnvServer")
Call dllApp.SetEnvironment("c:\\MentorGraphics\\PADSVX.2.5\\SDD_HOME")
' Launch the specific version of the Layout Application
Dim app
Set app = CreateObject("PowerPCB.Application" & "." &
dllApp.ProgIDVersion)
app.Visible = True
' Open a message box
MsgBox "Click OK to close PADS Layout " & dllApp.sddVersion, vbOKOnly,
"Layout Automation"
' Exit Layout
app.QuitOption Explicit
On Error Resume Next
Dim textFile
Dim strHome : strHome=""
dim strPlatform : strPlatform = ""
textFile = "TestOutput.txt"
' Get the application object
Dim dllApp
Set dllApp = CreateObject("MGCPCBReleaseEnvironmentLib.MGCPCBReleaseEnvServer")
Dim installedReleases
'Default environment -- no argument, write the parameters to a text file
dllApp.SetEnvironment("")
Call WriteTextToFile(textFile, "Default Environment:" & vbcrlf)
Call WriteTextToFile(textFile, "--------------------" & vbcrlf)
Call WriteTextToFile(textFile, "PROG_ID_VER=" & dllApp.ProgIDVersion & vbcrlf)
Call WriteTextToFile(textFile, "SDD_VERSION=" & dllApp.sddVersion & vbcrlf)
Call WriteTextToFile(textFile, "SDD_HOME=" & dllApp.sddHome & vbcrlf)
Call WriteTextToFile(textFile, "SDD_PLATFORM=" & dllApp.sddPlatform & vbcrlf)
Call WriteTextToFile(textFile, vbcrlf)
' Specific environment -- set to PADS VX.2.5, write the parameters
' to a text file
Call dllApp.SetEnvironment("c:\\MentorGraphics\\PADSVX.2.5\\SDD_HOME")
Call WriteTextToFile(textFile, "Specific Environment:" & vbcrlf)
Call WriteTextToFile(textFile, "---------------------" & vbcrlf)
Call WriteTextToFile(textFile, "PROG_ID_VER=" & dllApp.ProgIDVersion & vbcrlf)
Call WriteTextToFile(textFile, "SDD_VERSION=" & dllApp.sddVersion & vbcrlf)
Call WriteTextToFile(textFile, "SDD_HOME=" & dllApp.sddHome & vbcrlf)
Call WriteTextToFile(textFile, "SDD_PLATFORM=" & dllApp.sddPlatform & vbcrlf)
Call WriteTextToFile(textFile, vbcrlf)
If(Err) Then
MsgBox Err.Description
Err.Clear
End If
' Get all PCB releases on this machine and output them to a text file.
installedReleases = dllApp.GetInstalledReleases
Call WriteTextToFile(textFile, "List of installed releases:" & vbcrlf)
Call WriteTextToFile(textFile, "---------------------------" & vbcrlf)
WriteReleaseInformationFile(installedReleases)
Call WriteTextToFile(textFile, vbcrlf)
If(Err) Then
MsgBox Err.Description
Err.Clear
End If
Function WriteTextToFile(fileName, text)
Dim FSO
Set FSO = CreateObject("Scripting.FileSystemObject")
Dim file
Set file = FSO.OpenTextFile(fileName, 8,true)
Call file.Write(text)
Call file.Close()
End Function
Sub WriteReleaseInformationFile(arrResults)
Dim str: str = ""
Dim i,j
For i = 0 To UBound(arrResults,1)
For j = 0 To UBound(arrResults,2)
'wrap token in "" and add a ,
str = str & """" & arrResults(i, j) & """" & ","
Next
str = str & vbCrLf 'add newline after each release/row
Next
Call WriteTextToFile(textFile, str)
End Sub