'DISCLAIMER 'THE MATERIAL AND/OR SOFTWARE IS PROVIDED 'AS IS'. RATIONAL AND ITS 'THIRD PARTY LICENSORS DISCLAIM ALL 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. Option Explicit 'START FUNCTION------------------------------------ 'This function returns a collection of NoteViews 'containing all the scripts attached to the given 'message on the given scenario diagram Function ScriptsAttachedToMessage _ (theMessage As Message, theDiag As ScenarioDiagram) _ As NoteViewCollection Dim themessageview As roseitemview Dim theItemViews As ItemViewCollection Dim theitemview As roseitemview Dim theintermessview As roseitemview Dim thenote As noteview Dim thenoteviewcollection As New noteviewcollection Dim i As Integer Set theMessageView = theDiag.GetViewFrom(theMessage) Set theInterMessView = theMessageView.parentview Set theItemViews = theDiag.ItemViews For i = 1 To theItemViews.count Set theItemView = theItemViews.getat(i) 'check if this RoseItem is a NoteView If (theItemView.cantypecast(theNote) ) Then Set theNote = theitemview.typecast(thenote) 'Check if this NoteView is of type Script If theNote.getPropertyclassname="Script" Then 'Check if the script has a parent view If (theNote.hasParentView) Then Dim theparentview As roseitemview Set theParentView = theNote.parentView 'check if the parent view of the script 'is also the parent view of the message 'theparentView has type InterMessView If (theparentview Is theintermessview) Then theNoteviewcollection.add theNote End If End If End If End If Next i Set ScriptsAttachedToMessage = thenoteviewcollection End Function 'END FUNCTION------------------------------------ Sub printMessagesAndScripts(theDiag As ScenarioDiagram) Dim i As Integer , j As Integer, k As Integer Dim theMessage As message Dim thelink As link Dim themessageview As roseitemview Dim theNoteViews As NoteViewCollection Dim theCollection As MessageCollection Dim theNote As Noteview Set theCollection = theDiag.getMessages Dim theItemViews As ItemViewCollection Dim theitemview As roseitemview Print "Messages and attached scripts" For i = 1 To theCollection.count Set theMessage = theCollection.getat(i) Set theMessageView = theDiag.GetViewFrom(theMessage) Print i, "MessageName: "+ theMessage.name For j = 1 To ScriptsAttachedToMessage(theMessage, theDiag).count Print Cstr(i)+"."+CStr(j)+" AttachedScript: "+ _ ScriptsAttachedToMessage(theMessage, theDiag).getat(j).text Next j Next i End Sub Sub Main Dim theDiag As Diagram Dim theSeqDiag As ScenarioDiagram viewport.open viewport.clear Set theDiag=RoseApp.CurrentModel._ GetSelectedDiagrams.getat(1) If theDiag Is Nothing Then msgbox "No diagram selected" ElseIf theDiag.cantypecast(theSeqDiag) Then Set theSeqDiag = theDiag.typecast(theSeqDiag) Call printMessagesAndScripts(theSeqDiag) Else msgbox "The Selected Diagram is not a Sequence diagram Diagram" End If End Sub