Auto Common Useref
Auto Common Useref
Auto Common Useref
Document Revision 5
This document contains information that is proprietary to Mentor Graphics Corporation. The original recipient of this
document may duplicate this document in whole or in part for internal business purposes only, provided that this entire
notice appears in all copies. In duplicating any part of this document, the recipient agrees to make every reasonable
effort to prevent the unauthorized use and distribution of the proprietary information.
Note - Viewing PDF files within a web browser causes some links not to function (see MG595892).
Use HTML for full navigation.
This document is for information and instruction purposes. Mentor Graphics reserves the right to make
changes in specifications and other information contained in this publication without prior notice, and the
reader should, in all cases, consult Mentor Graphics to determine whether any changes have been
made.
The terms and conditions governing the sale and licensing of Mentor Graphics products are set forth in
written agreements between Mentor Graphics and its customers. No representation or other affirmation
of fact contained in this publication shall be deemed to be a warranty or give rise to any liability of Mentor
Graphics whatsoever.
MENTOR GRAPHICS MAKES NO WARRANTY OF ANY KIND WITH REGARD TO THIS MATERIAL
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE.
MENTOR GRAPHICS SHALL NOT BE LIABLE FOR ANY INCIDENTAL, INDIRECT, SPECIAL, OR
CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING BUT NOT LIMITED TO LOST PROFITS)
ARISING OUT OF OR RELATED TO THIS PUBLICATION OR THE INFORMATION CONTAINED IN IT,
EVEN IF MENTOR GRAPHICS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
U.S. GOVERNMENT LICENSE RIGHTS: The software and documentation were developed entirely at
private expense and are commercial computer software and commercial computer software
documentation within the meaning of the applicable acquisition regulations. Accordingly, pursuant to
FAR 48 CFR 12.212 and DFARS 48 CFR 227.7202, use, duplication and disclosure by or for the U.S.
Government or a U.S. Government subcontractor is subject solely to the terms and conditions set forth in
the license agreement provided with the software, except for provisions which are contrary to applicable
mandatory federal laws.
TRADEMARKS: The trademarks, logos and service marks ("Marks") used herein are the property of
Mentor Graphics Corporation or other parties. No one is permitted to use these Marks without the prior
written consent of Mentor Graphics or the owner of the Mark, as applicable. The use herein of a third-
party Mark is not an attempt to indicate Mentor Graphics as a source of a product, but is intended to
indicate a product from, or associated with, a particular third party. A current list of Mentor Graphics’
trademarks may be viewed at: mentor.com/trademarks.
The registered trademark Linux® is used pursuant to a sublicense from LMI, the exclusive licensee of
Linus Torvalds, owner of the mark on a world-wide basis.
End-User License Agreement: You can print a copy of the End-User License Agreement from:
mentor.com/eula.
Author: In-house procedures and working practices require multiple authors for documents. All
associated authors for each topic within this document are tracked within the Mentor Graphics
Technical Publication’s source. For specific topic authors, contact Mentor Graphics Technical
Publication department.
Revision History: Released documents include a revision history of up to four revisions. For
earlier revision history, refer to earlier releases of documentation on Support Center.
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
4 Common Automation Reference, PADS VX.2.7
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
Table of Contents
Chapter 1
Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Chapter 2
Scripting With Multiple Installs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Identifying the COM Version Number of an Install . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
COM Version Script Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
ReleaseEnvServer Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
GetInstalledReleases Method (ReleaseEnvServer Object). . . . . . . . . . . . . . . . . . . . . . . . . 18
SetEnvironment Method (ReleaseEnvServer Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
ProgIDVersion Property (ReleaseEnvServer Object). . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
sddHome Property (ReleaseEnvServer Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
sddPlatform Property (ReleaseEnvServer Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
sddVersion Property (ReleaseEnvServer Object). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
Release Environment Server Enumerated Types. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
EReleaseEnvErrCode Enum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Chapter 3
Scripting Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Scripting Object Data Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Program IDs for Applications and Automation Engines . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Scripting Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
AddTypeLibrary Method (Scripting Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
AttachEvents Method (Scripting Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
CreateObject Method (Scripting Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
DetachEvents Method (Scripting Object). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
ExpandEnvironmentStrings Method (Scripting Object). . . . . . . . . . . . . . . . . . . . . . . . . . . 37
GetEnvVariable Method (Scripting Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
SetEnvVariable Method (Scripting Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
Sleep Method (Scripting Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
DontExit Property (Scripting Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
Globals Property (Scripting Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
IsUnix Property (Scripting Object). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
OSName Property (Scripting Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
OSVersion Property (Scripting Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
Struct Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
Count Property (Struct Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
Data Property (Struct Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
Item Property (Struct Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
Keys Property (Struct Object). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
Chapter 4
CommandBar Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
CommandBarServer Data Model. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
CommandBar Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
Controls Property (CommandBar Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
CommandBarButton Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
Delete Method (CommandBarButton Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
BitmapFile Property (CommandBarButton Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
BitmapResource Property (CommandBarButton Object) . . . . . . . . . . . . . . . . . . . . . . . . . 59
Caption Property (CommandBarButton Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
DescriptionText Property (CommandBarButton Object) . . . . . . . . . . . . . . . . . . . . . . . . . . 61
Enabled Property (CommandBarButton Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
ExecuteMethod Property (CommandBarButton Object) . . . . . . . . . . . . . . . . . . . . . . . . . . 63
Id Property (CommandBarButton Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
OnAction Property (CommandBarButton Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
ResourceDLL Property (CommandBarButton Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
Target Property (CommandBarButton Object). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
TooltipText Property (CommandBarButton Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
UpdateMethod Property (CommandBarButton Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
CommandBarControl Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
Delete Method (CommandBarControl Object). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
Caption Property (CommandBarControl Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
CommandBarPopup Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
Delete Method (CommandBarPopup Object). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
Caption Property (CommandBarPopup Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
Controls Property (CommandBarPopup Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
CommandBarControls Collection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
Add Method (CommandBarControls Collection). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
Count Property (CommandBarControls Collection) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
Item Property (CommandBarControls Collection). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
CommandBars Collection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
Item Property (CommandBars Collection) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
Command Bar Enumerated Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
CmdControlType Enum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
Chapter 5
KeyBind Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
KeyBindServer Data Model. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
KeyBinding Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
Command Property (KeyBinding Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
ExecuteMethod Property (KeyBinding Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
Id Property (KeyBinding Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
Key Property (KeyBinding Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
KeyType Property (KeyBinding Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
Target Property (KeyBinding Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
Type Property (KeyBinding Object). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
VirtualKey Property (KeyBinding Object). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
BindingTables Collection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
Chapter 6
Addin Controls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
Addin Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
Active Property (Addin Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
Control Property (Addin Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
ClassID Property (Addin Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
Description Property (Addin Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
DisplayName Property (Addin Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
Group Property (Addin Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
Name Property (Addin Object). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
Placement Property (Addin Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
ProgID Property (Addin Object). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
ShortCutKey Property (Addin Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
Visible Property (Addin Object). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
Width Property (Addin Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
MGCAddins Collection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
Add Method (MGCAddins Collection) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
Remove Method (MGCAddins Collection) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
Count Property (MGCAddins Collection) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
Item Property (MGCAddins Collection) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
Addins Enumerated Types. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
PlacementLocation Enum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
Chapter 7
JScriptHelper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
JScriptHelper Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
ToScriptArray Method (JScriptHelper Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
Nothing Property (JScriptHelper Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
JScriptHelper Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
Third-Party Information
End-User License Agreement
with EDA Software Supplemental Terms
This document provides reference information about servers that are common to multiple
Mentor Graphics applications. This information is useful for anyone seeking to develop
automation scripts for use with PADS Designer or other Mentor Graphics tools.
The servers described in this document are:
• The ReleaseEnvServer object, which enables you to manage scripts on machines that
have multiple PCB software installs. See Scripting With Multiple Installs.
• Scripting Object server, which is available to all applications. That is, you do not need
any special calls in your script to include this server.
• The CommandBar Server, which allows you to customize the toolbars and menus of
applications.
• The KeyBind Server, which allows you to define custom shortcut or key accelerators for
applications.
• The Addin Controls, which allows you to include and run add-ins in the applications.
• The JScriptHelper, which is available to all applications. That is, you do not need any
special calls in your script to include this server.
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
Introduction
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
Chapter 2
Scripting With Multiple Installs
You can develop and run scripts on a machine with multiple Mentor PCB releases installed. To
determine which install the script calls, you include a COM version number when you create
application instances in your scripts. With more complex scripts, you can query the installed
releases on a machine and perform different actions based on the environment.
Note
If you do not include COM version numbers in your scripts, the version defaults to the last
software install tree.
Topic Description
Identifying the COM Version To use Mentor automation in a design environment
Number of an Install where multiple software installs/releases exist on the
same machine, you must know the COM version
number for each of the installs.
COM Version Script Examples VBScript examples show you how to manage scripts on
systems that have multiple Mentor PCB software
installs.
ReleaseEnvServer Object The ReleaseEnvServer object provides access to the
PCB software install environment. The COM version
of this object does not change.
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
Scripting With Multiple Installs
Identifying the COM Version Number of an Install
Procedure
Use any of the following methods to determine the COM Version Number:
[HKLM32_MGC_4]
SDD_VERSION: PADSProVX.1
SDD_HOME:
C:\MentorGraphics\PADSProVX.1\SDD_HOME
SDD_PLATFORM: win32
COM_VERSION: 3
[HKCU_MGC_2]
SDD_VERSION: EEVX.1
SDD_HOME: C:\MentorGraphics\EEVX.1\SDD_HOME
SDD_PLATFORM: win32
COM_VERSION: 9
Related Topics
COM Version Script Examples
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
Scripting With Multiple Installs
COM Version Script Examples
ReleaseEnvServer Object
To start a 32-bit command prompt, do one of the following, depending on your operating
system:
' Create an instance of the Layout application (for PADS VX.2.5 install).
Set app = CreateObject("PowerPCB.Application.78")
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
Scripting With Multiple Installs
COM Version Script Examples
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
Scripting With Multiple Installs
COM Version Script Examples
textFile = "TestOutput.txt"
' Get the application object
Dim dllApp
Set dllApp = CreateObject("MGCPCBReleaseEnvironmentLib.MGCPCBReleaseEnvSer
ver")
Dim installedReleases
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
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
Scripting With Multiple Installs
COM Version Script Examples
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
Related Topics
Identifying the COM Version Number of an Install
ReleaseEnvServer Object
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
Scripting With Multiple Installs
ReleaseEnvServer Object
ReleaseEnvServer Object
The ReleaseEnvServer object provides access to the PCB software install environment. The
COM version of this object does not change.
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
Scripting With Multiple Installs
GetInstalledReleases Method (ReleaseEnvServer Object)
Examples
Dim installedReleases
installedReleases = ReleaseEnvServer.GetInstalledReleases
WriteReleaseInformationFile(installedReleases)
...
Sub WriteReleaseInformationFile(arrResults)
' This function wraps each array element in quotes.
' Each string token is followed by a comma (,).
' Each “row” adds a newline.
' The str is output to a text file.
'
Dim str: str = ""
Dim i,j
For i = 0 To UBound(arrResults,1)
For j = 0 To UBound(arrResults,2)
str = str & """" & arrResults(i, j) & """" & ","
Next
str = str & vbCrLf
Next
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
Scripting With Multiple Installs
GetInstalledReleases Method (ReleaseEnvServer Object)
"COM_VERSION","SDD_HOME","SDD_PLATFORM","SDD_VERSION",
"9","C:\MentorGraphics\EEVX.1\SDD_HOME","win32","EEVX.1",
“3”,“C:\MentorGraphics\PADSProVX.1\SDD_HOME”,”win32”,”PADSProVX.1”,
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
Scripting With Multiple Installs
SetEnvironment Method (ReleaseEnvServer Object)
Examples
' Set the default environment -- no parameters
dllApp.SetEnvironment("")
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
Scripting With Multiple Installs
ProgIDVersion Property (ReleaseEnvServer Object)
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
Scripting With Multiple Installs
sddHome Property (ReleaseEnvServer Object)
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
Scripting With Multiple Installs
sddPlatform Property (ReleaseEnvServer Object)
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
Scripting With Multiple Installs
sddVersion Property (ReleaseEnvServer Object)
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
Scripting With Multiple Installs
Release Environment Server Enumerated Types
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
Scripting With Multiple Installs
EReleaseEnvErrCode Enum
EReleaseEnvErrCode Enum
Prerequisites: None.
Release Environment Server error codes.
Usage
EReleaseEnvErrCode.Constant
Arguments
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
Scripting With Multiple Installs
EReleaseEnvErrCode Enum
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
Scripting With Multiple Installs
EReleaseEnvErrCode Enum
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
Chapter 3
Scripting Server
Scripting Object server is available to all applications. That is, you do not need any special calls
in your script to include this server.
Scripting Object Data Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Program IDs for Applications and Automation Engines . . . . . . . . . . . . . . . . . . . . . . . . . 30
Scripting Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
AddTypeLibrary Method (Scripting Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
AttachEvents Method (Scripting Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
CreateObject Method (Scripting Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
DetachEvents Method (Scripting Object). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
ExpandEnvironmentStrings Method (Scripting Object). . . . . . . . . . . . . . . . . . . . . . . . . . . 37
GetEnvVariable Method (Scripting Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
SetEnvVariable Method (Scripting Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
Sleep Method (Scripting Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
DontExit Property (Scripting Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
Globals Property (Scripting Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
IsUnix Property (Scripting Object). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
OSName Property (Scripting Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
OSVersion Property (Scripting Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
Struct Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
Count Property (Struct Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
Data Property (Struct Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
Item Property (Struct Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
Keys Property (Struct Object). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
Scripting Server
Program IDs for Applications and Automation Engines
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
Scripting Server
Program IDs for Applications and Automation Engines
Table 3-1. Program IDs for Applications and Automation Engines (cont.)
ManufacturingValidationOutput MGCPCBEngines.ManufacturingOutputValidation
NCDrill MGCPCBEngines.NCDrill
NeutralFileExport MGCPCBEngines.NeutralFileExport
ODBPPOutputEngine MGCPCBEngines.ODBPPOutputEngine
PADS Designer ViewDraw.Application
PADS Layout PowerPCB.Application
PADS Logic PowerLogic.Application
PADS Router BlazeRouter.Application
Padstack Editor MGCPCBLibraries.PadstackEditorDlg
Part Editor MGCPCBLibraries.PartsEditorDlg
PDFOutput MGCPCBEngines.PDFOutput
SFX RE MGCPCB.SFXREApplication
SilkscreenGen MGCPCBEngines.SilkscreenGen
Xpedition Designer ViewDraw.Application
Xpedition FabLink MGCPCB.FablinkXEApplication
Xpedition FabLink Drawing Editor MGCPCB.DrawingEditorApplication
Xpedition FabLink Drawing Wizard MGCPCBEngines.DrawingFileWizard
Xpedition Layout MGCPCB.ExpeditionPCBApplication
Xpedition Layout Planner MGCPCB.PlannerPCBApplication
Xpedition Layout Viewer MGCPCB.ViewerPCBApplication
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
Scripting Server
Scripting Object
Scripting Object
The Scripting object provides a means of attaching events to dynamically created COM objects.
It also provides other useful properties and methods when running script with mgcscript
command. The Scripting object is automatically created and added to the currently running
script as a variable named Scripting.
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
Scripting Server
AddTypeLibrary Method (Scripting Object)
Examples
' Use any constants defined in MGCPCB Automation layer
Call Scripting.AddTypeLibrary("MGCPCB.Application")
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
Scripting Server
AttachEvents Method (Scripting Object)
Examples
' Attach application object to its event handlers with prefix appEvents
Dim app
Set app = GetObject(, "MGCPCB.Application")
Call Scripting.AttachEvents(app, "appEvents")
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
Scripting Server
CreateObject Method (Scripting Object)
Examples
' Create a PADS Layout application object
Dim appPCB
Set appPCB = Scripting.CreateObject("PowerPCB.Application.78")
Related Topics
Scripting With Multiple Installs
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
Scripting Server
DetachEvents Method (Scripting Object)
Examples
' Detach application object from its event handlers with prefix appEvents
Dim app
Set app = GetObject(, "MGCPCB.Application")
Call Scripting.DetachEvents(app, "appEvents")
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
Scripting Server
ExpandEnvironmentStrings Method (Scripting Object)
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
Scripting Server
GetEnvVariable Method (Scripting Object)
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
Scripting Server
SetEnvVariable Method (Scripting Object)
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
Scripting Server
Sleep Method (Scripting Object)
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
Scripting Server
DontExit Property (Scripting Object)
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
Scripting Server
Globals Property (Scripting Object)
Usage
Scripting.Globals
Arguments
None
Return Values
Object. The Scripting Object.
Examples
To store a global name/key - value pair:
Scripting.Globals("MyGlobalName") = "MyGlobalValue"
MsgBox Scripting.Globals("MyGlobalName")
’ Returns “MyGlobalValue”
Scripting.Globals.Data(“MyGlobalObjName”) = myObj
MsgBox Scripting.Globals("MyGlobalObjName").Name
’ Returns the value of myObj.Name
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
Scripting Server
IsUnix Property (Scripting Object)
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
Scripting Server
OSName Property (Scripting Object)
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
Scripting Server
OSVersion Property (Scripting Object)
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
Scripting Server
Struct Object
Struct Object
The Struct object holds Key - Value pairs. This object returns from the Globals Property
(Scripting Object).
The Struct object is a static object in the context of a process space. Therefore, any in-process
script or form that accesses the Struct object is accessing the same object. This means that one
script can write data to the object and a different script can read the same data.
The Globals Property (Scripting Object) works only in the current process space.
Table 3-3. Struct Object Properties
Property Description
Count Property (Struct Returns the number of items in the struct object.
Object)
Data Property (Struct Sets or returns an object.
Object)
Item Property (Struct Sets or returns a value based on a name/key.
Object)
Keys Property (Struct Returns the collection of names/keys.
Object)
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
Scripting Server
Count Property (Struct Object)
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
Scripting Server
Data Property (Struct Object)
Examples
To store a global object:
MsgBox Scripting.Globals("MyGlobalObjName").Name
’ Returns the value of myObj.Name
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
Scripting Server
Item Property (Struct Object)
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
Scripting Server
Keys Property (Struct Object)
Examples
To iterate the keys:
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
Chapter 4
CommandBar Server
The CommandBar Server lets you to customize the toolbars and menus of applications.
CommandBarServer Data Model. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
CommandBar Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
Controls Property (CommandBar Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
CommandBarButton Object. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
Delete Method (CommandBarButton Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
BitmapFile Property (CommandBarButton Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
BitmapResource Property (CommandBarButton Object) . . . . . . . . . . . . . . . . . . . . . . . . . 59
Caption Property (CommandBarButton Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
DescriptionText Property (CommandBarButton Object) . . . . . . . . . . . . . . . . . . . . . . . . . . 61
Enabled Property (CommandBarButton Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
ExecuteMethod Property (CommandBarButton Object) . . . . . . . . . . . . . . . . . . . . . . . . . . 63
Id Property (CommandBarButton Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
OnAction Property (CommandBarButton Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
ResourceDLL Property (CommandBarButton Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
Target Property (CommandBarButton Object). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
TooltipText Property (CommandBarButton Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
UpdateMethod Property (CommandBarButton Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
CommandBarControl Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
Delete Method (CommandBarControl Object). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
Caption Property (CommandBarControl Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
CommandBarPopup Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
Delete Method (CommandBarPopup Object). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
Caption Property (CommandBarPopup Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
Controls Property (CommandBarPopup Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
CommandBarControls Collection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
Add Method (CommandBarControls Collection). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
Count Property (CommandBarControls Collection) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
Item Property (CommandBarControls Collection). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
CommandBars Collection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
Item Property (CommandBars Collection) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
Command Bar Enumerated Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
CmdControlType Enum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
CommandBar Server
CommandBarServer Data Model
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
CommandBar Server
CommandBar Object
CommandBar Object
Lists the CommandBarControl properties.
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
CommandBar Server
Controls Property (CommandBar Object)
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
CommandBar Server
CommandBarButton Object
CommandBarButton Object
Lists the CommandBarButton methods and properties.
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
CommandBar Server
CommandBarButton Object
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
CommandBar Server
Delete Method (CommandBarButton Object)
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
CommandBar Server
BitmapFile Property (CommandBarButton Object)
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
CommandBar Server
BitmapResource Property (CommandBarButton Object)
Description
If the ResourceDLL is not set, the bitmap is not loaded. For more information on resources and
C++ clients for Automation see the MSDN site.
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
CommandBar Server
Caption Property (CommandBarButton Object)
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
CommandBar Server
DescriptionText Property (CommandBarButton Object)
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
CommandBar Server
Enabled Property (CommandBarButton Object)
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
CommandBar Server
ExecuteMethod Property (CommandBarButton Object)
Examples
'
' This example add a menu entry to execute a method defined in the script
'
' With the menu controls collection
Set button = myMenuCtrls.Add
button.Caption = "Zoom Selected"
button.Target = ScriptEngine
button.ExecuteMethod = "myZoomSelectedMethod"
' call function below with this name
button.DescriptionText = "Zoom around selected objects"
Sub myZoomSelectedMethod( )
' zoom around selected objects
doc.ActiveViewEx.SetExtentsToSelection
End Sub
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
CommandBar Server
Id Property (CommandBarButton Object)
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
CommandBar Server
Id Property (CommandBarButton Object)
Examples
'
' This example walks through the menus of a PCB application and
' write the menu name and its command ID out to a output file.
'
' Create an output file
Set filesys = CreateObject("Scripting.FileSystemObject")
file = "c:\temp\output.txt"
Set filetxt = filesys.CreateTextFile(file, True)
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
CommandBar Server
OnAction Property (CommandBarButton Object)
Description
This property is used for creating a new menu entry or toolbar button associated with a PCB
application built-in command, or key-in command.
Examples
'
' This example adds a menu entry using built-in command, Highlight
'
' With the menu object (CommandBar) defined
Set cntrls = menu.Controls
Set button = cntrls.Add
button.Caption = "&Highlight"
button.OnAction = "32867" ' 32867 is the ID of the built-in command,
Highlight
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
CommandBar Server
ResourceDLL Property (CommandBarButton Object)
Description
This property is used in conjunction with the BitmapResource property.
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
CommandBar Server
Target Property (CommandBarButton Object)
Sub myZoomSelectedMethod( )
' zoom around selected objects
doc.ActiveViewEx.SetExtentsToSelection
End Sub
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
CommandBar Server
TooltipText Property (CommandBarButton Object)
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
CommandBar Server
UpdateMethod Property (CommandBarButton Object)
Examples
'
' This example add a menu entry to execute a key-in command, "pr *" with a
' user-defined update method to enable/disable the menu entry
'
' With the menu controls collection object (CommandBarControls) defined
Set button = myMenuCtrls.Add
button.Caption = "Place Unplaced Parts"
button.OnAction = "pr *"
button.Target = ScriptEngine
button.UpdateMethod = "onUpdatePlaceUnplaced"
' call update method below with this name
Function onUpdatePlaceUnplaced(nID)
' Disable the command if no unplaced parts
If doc.components(epcbSelectUnplaced).count > 0 Then
onUpdatePlaceUnplaced = true
Else
onUpdatePlaceUnplaced = false
End If
End Function
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
CommandBar Server
CommandBarControl Object
CommandBarControl Object
Lists the CommandBarControl methods and properties.
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
CommandBar Server
Delete Method (CommandBarControl Object)
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
CommandBar Server
Caption Property (CommandBarControl Object)
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
CommandBar Server
CommandBarPopup Object
CommandBarPopup Object
Lists the CommandBarPopup methods and properties.
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
CommandBar Server
Delete Method (CommandBarPopup Object)
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
CommandBar Server
Caption Property (CommandBarPopup Object)
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
CommandBar Server
Controls Property (CommandBarPopup Object)
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
CommandBar Server
CommandBarControls Collection
CommandBarControls Collection
Lists the CommandBarControls methods and properties.
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
CommandBar Server
Add Method (CommandBarControls Collection)
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
CommandBar Server
Count Property (CommandBarControls Collection)
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
CommandBar Server
Item Property (CommandBarControls Collection)
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
CommandBar Server
CommandBars Collection
CommandBars Collection
Lists the CommandBars properties.
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
CommandBar Server
Item Property (CommandBars Collection)
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
CommandBar Server
Command Bar Enumerated Types
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
CommandBar Server
CmdControlType Enum
CmdControlType Enum
Constants for CommandBarControls Add method.
Usage
CmdControlType.Constant
Arguments
• Constant
You can specify three types of constants:
cmdControlButton
The value for this constant is 0. Button control.
cmdControlButtonSeparator
The value for this constant is 2. Button Separator.
cmdControlPopup
The value for this constant is 1. Popup menu control.
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
CommandBar Server
CmdControlType Enum
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
Chapter 5
KeyBind Server
The KeyBind Server lets you to define custom shortcuts or key accelerators for applications.
KeyBindServer Data Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
KeyBinding Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
Command Property (KeyBinding Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
ExecuteMethod Property (KeyBinding Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
Id Property (KeyBinding Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
Key Property (KeyBinding Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
KeyType Property (KeyBinding Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
Target Property (KeyBinding Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
Type Property (KeyBinding Object). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
VirtualKey Property (KeyBinding Object). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
BindingTables Collection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
AddKeyBinding Method (BindingTables Collection) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
AddStrokeBinding Method (BindingTables Collection) . . . . . . . . . . . . . . . . . . . . . . . . . . 100
Bindings Property (BindingTables Collection) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
Item Property (BindingTables Collection) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
KeyBindings Collection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
Remove Method (KeyBindings Collection) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
Count Property (KeyBindings Collection) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
Item Property (KeyBindings Collection) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
Key Binding Enumerated Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
BindKeyType Enum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
BindType Enum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
KeyBind Server
KeyBindServer Data Model
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
KeyBind Server
KeyBinding Object
KeyBinding Object
Lists the KeyBinding properties.
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
KeyBind Server
Command Property (KeyBinding Object)
Examples
' With BindingTables object defined
' Assign shortcut keys Alt+F1 to Help->Contents->Automation
docBindingTables.AddKeyBinding "Alt+F1","Help->Contents->Automation",0,1
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
KeyBind Server
ExecuteMethod Property (KeyBinding Object)
Examples
'
' This example adds a key binding to execute a method defined in the
' script
'
' Assign shortcut keys Alt+F1 to myZoomSelectedMethod
Set bindObj = docBindingTables.AddKeyBinding ("Alt+F1", _
"myZoomSelectedMethod", BindFunction, BindAccelerator)
' Associate the current script engine with the key binding
bindObj.Target = ScriptEngine
' Call method below with this name
bindObj.ExecuteMethod = "myZoomSelectedMethod"
' Keep this script running so that the handler can be executed
Scripting.DontExit = True
Sub myZoomSelectedMethod( )
' Zoom around selected objects
doc.ActiveViewEx.SetExtentsToSelection
End Sub
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
KeyBind Server
Id Property (KeyBinding Object)
Examples
' With BindingTables object defined
' Assign shortcut keys Alt+F1 to Help->Contents->Automation
docBindingTables.AddKeyBinding "Alt+F1","Help->Contents->Automation",0,1
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
KeyBind Server
Key Property (KeyBinding Object)
Examples
' With BindingTables object defined
' Assign shortcut keys Alt+F1 to Help->Contents->Automation
docBindingTables.AddKeyBinding "Alt+F1","Help->Contents->Automation",0,1
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
KeyBind Server
KeyType Property (KeyBinding Object)
Examples
' With BindingTables object defined
' Assign shortcut keys Alt+F1 to Help->Contents->Automation
docBindingTables.AddKeyBinding "Alt+F1","Help->Contents->Automation",0,1
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
KeyBind Server
Target Property (KeyBinding Object)
' Associate the current script engine with the key binding
bindObj.Target = ScriptEngine
' Call method below with this name
bindObj.ExecuteMethod = "myZoomSelectedMethod"
' Keep this script running so that the handler can be executed
Scripting.DontExit = True
Sub myZoomSelectedMethod( )
' Zoom around selected objects
doc.ActiveViewEx.SetExtentsToSelection
End Sub
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
KeyBind Server
Type Property (KeyBinding Object)
Examples
' With BindingTables object defined
' Assign shortcut keys Alt+F1 to Help->Contents->Automation
docBindingTables.AddKeyBinding "Alt+F1","Help->Contents->Automation", 0,1
' With KeyBindings object defined
' Type property will return 0 which is BindMenu constant
MsgBox docKeyBindings.Item(1).Type
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
KeyBind Server
VirtualKey Property (KeyBinding Object)
Examples
' With BindingTables object defined
' Assign shortcut keys Alt+2 to View->FitAll command
docBindingTables.AddKeyBinding "Alt+2", "View->FitAll", 0, 1
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
KeyBind Server
BindingTables Collection
BindingTables Collection
Lists the BindingTables methods and properties.
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
KeyBind Server
AddKeyBinding Method (BindingTables Collection)
Examples
' Get the document BindingTables object
Set docBindingTables = Gui.Bindings("Document")
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
KeyBind Server
AddStrokeBinding Method (BindingTables Collection)
Arguments
• String
A string that Stroke pattern.
• Command
A string that contains the menu command, script function, keyin command or key to assign
to the Stroke.
• BindType
A BindType constant that defines the command type—key press, menu command, script
function, or keyin command.
• UserData
(Optional) Reserved for future use.
Return Values
IKeyBinding. The new KeyBinding Object.
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
KeyBind Server
AddStrokeBinding Method (BindingTables Collection)
Examples
' Get the document BindingTables object
Set docBindingTables = Gui.Bindings("Document")
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
KeyBind Server
Bindings Property (BindingTables Collection)
Examples
' Get the document BindingTables object
Set docBindingTables = Gui.Bindings("Document")
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
KeyBind Server
Item Property (BindingTables Collection)
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
KeyBind Server
KeyBindings Collection
KeyBindings Collection
Lists the KeyBindings methods and properties.
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
KeyBind Server
Remove Method (KeyBindings Collection)
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
KeyBind Server
Count Property (KeyBindings Collection)
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
KeyBind Server
Item Property (KeyBindings Collection)
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
KeyBind Server
Key Binding Enumerated Types
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
KeyBind Server
BindKeyType Enum
BindKeyType Enum
KeyBindSvr Binding Type constants.
Usage
BindKeyType.Constant
Arguments
• Constant
You can specify two types of constants:
BindAccelerator
The value for this constant is 1. Assign the shortcut keys in the accelerator table.
BindKey
The value for this constant is 2. Reserved for future use.
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
KeyBind Server
BindType Enum
BindType Enum
KeyBindSvr Binding Key Type constants.
Usage
BindType.Constant
Arguments
• Constant
You can specify two types of constants:
BindCommand
The value for this constant is 1. Assign the shortcut key or stroke to a key-in
command.
BindFunction
The value for this constant is 2. Assign the shortcut key or stroke to a end-user
function.
BindKeyPress
The value for this constant is 3. Assign the shortcut key or stroke to a key.
BindMenu
The value for this constant is 0. Assign the shortcut key or stroke to a menu
command.
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
Chapter 6
Addin Controls
The Addin Controls let you include and run add-ins in the applications.
Addin Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
Active Property (Addin Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
Control Property (Addin Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
ClassID Property (Addin Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
Description Property (Addin Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
DisplayName Property (Addin Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
Group Property (Addin Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
Name Property (Addin Object). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
Placement Property (Addin Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
ProgID Property (Addin Object). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
ShortCutKey Property (Addin Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
Visible Property (Addin Object). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
Width Property (Addin Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
MGCAddins Collection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
Add Method (MGCAddins Collection) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
Remove Method (MGCAddins Collection) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
Count Property (MGCAddins Collection) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
Item Property (MGCAddins Collection) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
Addins Enumerated Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
PlacementLocation Enum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
Addin Controls
Addin Object
Addin Object
Lists the Addin object properties.
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
Addin Controls
Active Property (Addin Object)
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
Addin Controls
Control Property (Addin Object)
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
Addin Controls
ClassID Property (Addin Object)
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
Addin Controls
Description Property (Addin Object)
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
Addin Controls
DisplayName Property (Addin Object)
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
Addin Controls
Group Property (Addin Object)
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
Addin Controls
Name Property (Addin Object)
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
Addin Controls
Placement Property (Addin Object)
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
Addin Controls
ProgID Property (Addin Object)
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
Addin Controls
ShortCutKey Property (Addin Object)
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
Addin Controls
Visible Property (Addin Object)
Description
The default value of this property is determined within the addin. So, you should specifically set
this property value when the addin is loaded.
Examples
Sub ToggleVisibility (nID)
'Called by Hide/Unhide Output Window menu item
If Not outputAddin Is Nothing Then
' Toggle Output Window visibility
If outputAddin.Visible Then
outputAddin.Visible = False
Else
outputAddin.Visible = True
End If
End If
End Sub
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
Addin Controls
Width Property (Addin Object)
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
Addin Controls
MGCAddins Collection
MGCAddins Collection
Lists the MGCAddins methods and properties.
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
Addin Controls
Add Method (MGCAddins Collection)
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
Addin Controls
Remove Method (MGCAddins Collection)
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
Addin Controls
Count Property (MGCAddins Collection)
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
Addin Controls
Item Property (MGCAddins Collection)
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
Addin Controls
Addins Enumerated Types
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
Addin Controls
PlacementLocation Enum
PlacementLocation Enum
Addin Object Placement Location Type constants.
Usage
PlacementLocation.Constant
Arguments
• Constant
You can specify three types of constants:
PlacementLocationBottom
The value for this constant is 3. Align the add-in control under the design window.
PlacementLocationLeft
The value for this constant is 0. Align the add-in control to the left of the design
window.
PlacementLocationRight
The value for this constant is 2. Align the add-in control to the right of the design
window.
PlacementLocationTop
The value for this constant is 1. Align the add-in control above the design window.
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
Addin Controls
PlacementLocation Enum
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
Chapter 7
JScriptHelper
The JScriptHelper object provides additional methods for using JScript to access automation in
Mentor Graphics applications.
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
JScriptHelper
JScriptHelper Object
JScriptHelper Object
Lists the JScriptHelper methods and properties.
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
JScriptHelper
ToScriptArray Method (JScriptHelper Object)
Description
In order to pass a points array (often used to create new design objects defined by a geometry),
you must convert any JScriptArrays to VBArrays.
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
JScriptHelper
Nothing Property (JScriptHelper Object)
Description
Currently, there is no null object available within JScript, even though many Mentor Graphics
methods require it.
JScriptHelper Example
The following is an example that shows the use of the JScriptHelper method and property.
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
JScriptHelper
JScriptHelper Example
// This example shows how you can use JScriptHelper to convert an array to
// a a VBArray which you can then pass to other Mentor Grapics apis.
// Once you have a JScript array, you can use JScript to modify the array.
// This function uses JScript functionality to modify all elements of a
// JScript array.
// Assume jArr is an initialized JScript array.
for (i = 0; i < jArr[0].length; i++)
{
jArr[0][i] = parseFloat(jArr[0][i]) + 100;
}
// Before passing the array back to the interface convert
// it back to a SAFEARRAY. This can be done inline.
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
JScriptHelper
JScriptHelper Example
//'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
//Local functions
function ToSafePntsArray(jArr)
{
return oHelper.ToSafeArray(jArr);
}
return arr;
}
// This function reads a JScript array into a stream format so that it can
// be displayed or output.
function GetPointsArrayString(pnts)
{
var i,j;
var str="";
for(i = 0; i<pnts[0].length; i++) {
str = str + "(" + pnts[0][i];
str = str + "," + pnts[1][i];
str = str + "," + pnts[2][i] + ")";
str = str + '
}
return str;
}
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
JScriptHelper
JScriptHelper Example
function ValidateServer(docObj) {
var keyInt;
var licenseTokenInt;
var licenseServerObj;
var retValInt = 1;
return retValInt;
}
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
JScriptHelper
JScriptHelper Example
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
Third-Party Information
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
Note - Viewing PDF files within a web browser causes some links not to function. Use HTML for full navigation.
End-User License Agreement
with EDA Software Supplemental Terms
Use of software (including any updates) and/or hardware is subject to the End-User License Agreement together with the
Mentor Graphics EDA Software Supplement Terms. You can view and print a copy of this agreement at:
mentor.com/eula