'Disclaimer: 'THE MATERIAL AND/OR SOFTWARE IS PROVIDED 'AS IS'. 'RATIONAL AND ITS THIRD PARTY LICENSORS DISCLAIM ALL 'REPRESENTATIONS OR WARRANTIES EXPRESS OR IMPLIED INCLUDING, 'WITHOUT LIMITATION, THE WARRANTY OF MERCHANTABILITY, 'NON-INFRINGEMENT, TITLE OR FITNESS FOR A PARTICULAR PURPOSE 'OR ARISING OUT OF THE COURSE OF DEALING, USAGE OR TRADE PRACTICE, 'CONTENT OF THE MATERIAL OR SOFTWARE. RATIONAL MAKES NO WARRANTIES 'OR REPRESENTATIONS REGARDING THE ACCURACY OR COMPLETENESS OF 'THE MATERIAL AND/OR SOFTWARE PROVIDED OR THAT IT WILL MEET 'LICENSEE'S REQUIREMENTS OR THAT THE MATERIAL AND/OR SOFTWARE 'WILL BE ERROR FREE. IN NO EVENT SHALL RATIONAL OR ITS LICENSORS 'BE LIABLE TO LICENSEE OR A THIRD PARTY FOR ANY INDIRECT, DIRECT, 'NEGLIGENCE, SPECIAL, OR CONSEQUENTIAL DAMAGES INCLUDING LOST PROFITS, 'LOST DATA AND THE LIKE ARISING OUT OF OR IN CONNECTION WITH THIS 'RECEIPT OF MATERIAL AND/OR SOFTWARE EVEN IF RATIONAL HAS BEEN ADVISED 'OF THE POSSIBILITY OF SUCH DAMAGES. 'Description: 'This script will: '0. Ask for the desired Header and Source file extensions '1. Loop on all the selected components or on all components in selected packages. '2. Inspect the C++ property FileName. 'If it is set to AUTO GENERATE then the script will replace it with the name of 'the component followed by the extensions specified in input. 'Output is written to the Rose Log file 'A mesaage box signals the end of the execution Option Explicit Dim HeaderExtension As String Dim SourceExtension As String Sub GetSelectedComponents (SelectedComponents As ModuleCollection) Dim i As Integer Dim themodel As model Dim theSub As subsystem Set themodel = roseapp.currentmodel 'get individually selected components selectedComponents.AddCollection theModel.getselectedmodules 'get all components in selected packages For i = 1 To theModel.getselectedsubsystems.count Set thesub = themodel.getselectedsubsystems.getat(i) selectedcomponents.addCollection thesub.getallModules Next i roseapp.writeerrorlog str$(selectedComponents.count) +" components were selected" End Sub Sub GetExtensions HeaderExtension = AskBox$("Type Header extension (without initial .)") SourceExtension = AskBox$("Type Source extension (without initial .)") If headerExtension = "" Or sourceextension="" Then msgbox "Header or Source Extension is empty. Try again." End End If End Sub Sub ChangeFileName(SelectedComponents As ModuleCollection) Dim i As Integer Dim isOverridden As Boolean Dim theComp As Module For i = 1 To SelectedComponents.count Set theComp = SelectedComponents.getat(i) roseapp.writeerrorlog "Component: "+theComp.getqualifiedName+" FileName: "+ thecomp.getpropertyvalue("cg","FileName") +" Part: "+theComp.Part.Name If theComp.assignedlanguage = "C++" Then If thecomp.getpropertyvalue("cg","FileName") = "AUTO GENERATE" Then If theComp.Part.Name = "Specification" Then isOverridden = theComp.OverrideProperty("cg","FileName",theComp.name+"."+HeaderExtension) ElseIf theComp.Part.Name = "Body" Then isOverridden = theComp.OverrideProperty("cg","FileName",theComp.name+"."+SourceExtension) End If roseapp.writeerrorlog "New FileName: "+ thecomp.getpropertyvalue("cg","FileName") End If End If Next i End Sub Sub Main Dim SelectedComponents As New ModuleCollection Call GetExtensions Call GetSelectedComponents (SelectedComponents) Call ChangeFileName(SelectedComponents) msgbox "Execution terminated" End Sub