Where To Find This Script
You can run this script by clicking on Scripts->Layout-> Remove_Spaces_from_GDS_Filenames from AWRDE menu.
Description
This script will remove the spaces in GDSII libraries. 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. It will output which libraries and cells it changed in the Visual Basic debug window.
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.
Code
Option Explicit ' Code Module Sub Main Debug.Clear Dim cl As CellLibrary Dim c As Cell Dim clName As String Dim cName As String Dim newValue For Each cl In Project.CellLibraries clName = cl.Name If (InStr(clName," ") <> 0) Then newValue = StringReplace(clName," ","_",False) Debug.Print "Renamed " + cl.Name + " to " + newValue cl.Name = newValue End If For Each c In cl.Cells cName = c.Name If (InStr(cName," ") <> 0) Then newValue = StringReplace(cName," ","_",False) Debug.Print vbTab + "Renamed " + cl.Name + ">" + cName + " to " + newValue c.Name = newValue End If Next c Next cl End Sub Function StringReplace (origString As String, searchChars As String, newChar As String, allowFirstSpecial As Boolean) As String Dim i As Integer Dim data As String Dim char As String data = origString For i = 1 To Len(searchChars) char=Mid(searchChars,i,1) If (InStr(origString,char) <> 0) Then data = Replace(data, char, newChar) End If Next i 'Make sure the name doesn't begin with a special character If (allowFirstSpecial = False) Then While (Left(data,1) = newChar) data = Right(data,Len(data)-1) Wend End If StringReplace=data End Function