Here's a simple example of using GetSelectedItems to
identify items selected in the Browser

Sub Main 

 Dim items As itemCollection
 Dim anItem As RoseItem

 Set items = RoseApp.CurrentModel.GetSelectedItems()
 msgbox items.count

 Set anItem = items.getat(1)
 MsgBox anItem.IdentifyClass()
 MsgBox anItem.Name

End Sub

///////

To go the other way, selecting an object in the browser
there is an undocumented command SelectObjectInBrowser. 
Below is a example of it's usage.  A sample script that
prompts for a class name, then selects it in the browser.
NOTE: This script is a sample and still needs some work,
for example if there multiple classes with the same name 
it will only give you the first one, etc.


Sub Main

 Begin Dialog UserDialog ,,180,48,"Find Class"
     OKButton 132,8,40,14
     CancelButton 132,28,40,14
     Text 12,11,60,8,"Class to find:",.Text1
     TextBox 12,30,104,12,.ClassName
 End Dialog

 Dim MyDialog As UserDialog
 Dim theModel As Model
 Dim theClass As Class
 Dim theClasses As ClassCollection
 Dim ClassName As String
 Dim FullyQualifiedName As String


 Viewport.open "Classes found"

 result = Dialog(MyDialog)
 ClassName = MyDialog.ClassName
 Set theModel = RoseApp.CurrentModel
 Set theClasses = theModel.GetAllClasses()

  For i = 1 To theClasses.Count
    Set theClass = theClasses.GetAt(i)

   If theClass.Name = ClassName Then
   FullyQualifiedName = theClass.GetQualifiedName
   Print FullyQualifiedName
   RoseApp.SelectObjectInBrowser theClass
   End If
  Next i

 End Sub


Patrick Kennedy
 Ratioanl Support


-----Original Message-----
From: Ronald W Townsen [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 22, 2003 8:13 AM
To: [EMAIL PROTECTED]
Subject: (ROSE) Accessing Selected objects in the Browser using Rose
Scripting



I wish to select categories and class objects in the brower then within a
Rose Script, be able to identify for processing these objects.

I know how to access them from a Class Diagram, however I do not see the
access from the browser.

Can anyone give me some help?

************************************************************************
* Rose Forum is a public venue for ideas and discussions.
* For technical support, visit http://www.rational.com/support
* Only plain-text messages are supported.
* HTML or Rich-Text messages may be rejected.
*
* Post or Reply to: [EMAIL PROTECTED]
* Subscription Requests: [EMAIL PROTECTED]
* Archive of messages:
*    http://www.rational.com/support/usergroups/rose/rose_forum.jsp
* Other Requests: [EMAIL PROTECTED]
*
* To unsubscribe from the list, please send email
*    To: [EMAIL PROTECTED]
*    Subject: <BLANK>
*    Body: unsubscribe rose_forum
*************************************************************************
************************************************************************
* Rose Forum is a public venue for ideas and discussions.
* For technical support, visit http://www.rational.com/support
* Only plain-text messages are supported.
* HTML or Rich-Text messages may be rejected.
*
* Post or Reply to: [EMAIL PROTECTED]
* Subscription Requests: [EMAIL PROTECTED]
* Archive of messages:
*    http://www.rational.com/support/usergroups/rose/rose_forum.jsp
* Other Requests: [EMAIL PROTECTED]
*
* To unsubscribe from the list, please send email
*    To: [EMAIL PROTECTED]
*    Subject: <BLANK>
*    Body: unsubscribe rose_forum
*************************************************************************

Reply via email to