The procedure for requesting AWR support has changed. Please read all about the new AWR product support process.
Page tree
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Where To Find This Script

You can run this script by clicking on Scripts->Schematic->Remove_Space_from_Schematic_Names from AWRDE menu.


This script will replace spaces in schematic names loaded in the project with underscores. Some processes on computers are not tolerant of spaces in filenames, such as exporting layouts, etc. This script will automate removing any spaces in schematic names.

Scripting Information

Scripts included in the install are configured to run directly from the NI AWR Design Environment from the Scripts menu.

Scripts that you download must be imported into a project or placed in your global scripts folder to use them. See Working with VB Scripts for information on how to use these scripts.

You can also customize the AWRDE to run scripts from hotkeys, menus, or toolbar buttons. See Working with VB Scripts for more information.

For complete information about the AWRDE API, see the AWRDE API Programming Guide Help in the AWRDE installation. You can also view our Scripting Website for more scripting examples.



'This script loops through the project and replaces any spaces in schematic names with underscores.
'This should be used before making GDSII regression tests so that the resulting names don't have spaces.

' $MENU=Hidden
Sub Main


End Sub

' $MENU=Schematic
Sub Remove_Space_from_Schematic_Names
        Dim sch As Schematic
        Dim tks() As String
        Dim nm As String

        On Error GoTo A

        'Display a message if there are no schematics in the project and quit
        If Project.Schematics.Count = 0 Then
                MsgBox ("No schematic was found in the project","No Schematic Found")
                Exit Sub
        End If

        For Each sch In Project.Schematics
                'Debug.Print sch.Name
                tks = strtok_white(sch.Name)
                If UBound(tks) > 0 Then
                        nm = Join(tks,"_")
                        sch.Name = nm
                End If
        Next sch
        Exit Sub
A:      Dim msg As String
        msg = "An error has occurred (" + CStr(Err.Number) + "): " + Err.Description
        MsgBox(msg,vbOkOnly,"Script Error")
        Debug.Print msg
End Sub
Function strtok_white(x As String) As String()
        Dim newtoks() As String
        Dim tk() As String
        Dim cnt As Integer
        Dim i As Integer

        tk = Split(x)
        cnt = 0
        For i = 0 To UBound(tk)
                If Trim(tk(i))<> "" Then
                        ReDim Preserve newtoks(cnt)
                        newtoks(cnt) = tk(i)
                        'Debug.Print newtoks(cnt)
                        cnt = cnt+1
                End If
        Next i
        strtok_white = newtoks
End Function

  • No labels