You could store the variable data (author name, etc.) in the registry.
There are REI methods to set and get registry settings.

-----Original Message-----
From: Brian G. Lyons [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 18, 2001 7:41 AM
To: Patrick Kennedy; Williamson, Rusty; 'Rose Forum'
Subject: RE: (ROSE) Automating diagram comments?



hiho,

Note that while there is no Rose-supplied UI to get to them, diagrams have
properties just like all other model elements.  The author name, etc could
be stored there.

To get the author name into Patrick's script, just replace the line:
    Set note = Diag.AddNoteView(qName$, 2)
with the lines:
    author$ = diag.GetProperty("Comments", "Author")
    Set note = Diag.AddNoteView(qName$ + ebCrLf + "Author: " + author$, 2)

This script allows the author property to be set:
Sub Main
    Dim diag As Diagram
    Set diag = RoseApp.CurrentModel.GetActiveDiagram()
    If diag Is Nothing Then
        MsgBox "No active diagram"
        Exit Sub
    End If

    author$ = askbox$("Author", diag.GetPropertyValue("Comments", "Author"),
"Comments")
    b = diag.CreateProperty("Comments", "Author", author$, "String")
End Sub

A couple notes:
Patrick's script has to be modified to make sure it doesn't create a pile of
notes after it has been run a few times.  No big deal, you'll have to walk
the notes on the diagram and update the one that was created in the previous
run.  You can probably just assume that a note at the exact location you are
using is the right note.

I could be confused, but it seems to me that Peter's CM system idea will
only work of every package with a diagram is its own separate subunit and
only contains one diagram.

The use of the askbox in my example above is oversimplified; you'll want to
create a whole dialog that takes in the author name and the other relevant
data elements you want stored in properties.  In fact my askbox version will
clear out the author value if you hit the cancel button, so it definitely
needs a more robust implementation.  But you get the idea.

              ----- b

--
Brian G. Lyons
Number Six Software - Voted Rational's Best Complementary Service Provider
1655 North Fort Myer Drive, Suite 1100
Arlington, VA 22209-3196
http://www.numbersix.com


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Patrick Kennedy
Sent: Wednesday, January 17, 2001 11:08 PM
To: Williamson, Rusty; 'Rose Forum'
Subject: Re: (ROSE) Automating diagram comments?



Here's a simple example of a script that may help you
get started. It add's a note to the current active
with the name of the diagram.  Not sure how you
could program author, reviewer, last reviewed into
the script.  As far as last updated, I guess you
could look at the timestamp on the file,  see online
help, script function: FileDateTime. Also don't know
about triggering this on a new diagram, there is
OnNewModelElement, but using this would put you into
a loop (adding the note would trigger it again).

To use it, add a menu item
to call this script (see below) then go to the diagram,
and execute this script.

'add note with text to current (active) diagram

Sub Main

        Dim diag As Diagram
        Dim note As NoteView

        Set diag = RoseApp.CurrentModel.GetActiveDiagram()

        If diag Is Nothing Then
                MsgBox "No active diagram"
                Exit Sub
        End If

        qName$ = diag.name
        Set note = Diag.AddNoteView(qName$, 2)
        note.YPosition = 200
        note.XPosition = 1000

        'Print ">" & note.Text

        MsgBox "Done"

 End Sub


 Take note however that the script using the
 GetActiveDiagram method to get the diagram that you want
 to save to a graphic format.  This means that you must
 launch this script from a menu item in Rose.  You cannot
 run this script from a script window because if you try to
 do so the script window will be the active window and not
 a diagram window.  To launch this script from a menu
 selection you will need to modify the rose.mnu file
 (located in Rose's home directory --- location of rose.exe)
 in the following manner:


 Menu Tools

 {

   Separator
   option "Class Wizard..."
           {
              enable %model:writeable
              RoseScript $SCRIPT_PATH\cwizard.ebx
           }
   option "Save ActiveDiagram..."
           {
              RoseScript $SCRIPT_PATH\addnote.ebs
           }
 }


 In this case the script listed above is named
 RenderRoseDiagrams.ebs and is located in the directory
 pointed to by the $SCRIPT_PATH pathmap.

Patrick Kennedy
 Rational Support


On Jan 17, 12:04, Williamson, Rusty wrote:
> Subject: (ROSE) Automating diagram comments?
>
> Hello,
>
> There is a small comment box (note box) we require for each diagram --
> contains the package, diagram name, author, last updated, reviewer, last
> reviewed.  Is there any way to automate the creation of this comment box?
> Is there a 'base' template for each diagram that could be modified?  Is
> there some way to get a script to create it when the diagram is created or
> via an icon or control keys?
>
> Thanks,
> Rusty
> ---------------------------------------------------------------
> Rusty Williamson
> Sr. Systems Architect
>
> Corporate Office
> GERS, Inc.
> 10431 Wateridge Circle * San Diego, CA 92121
> (800) 854-2263 * CA (858) 457-3888
> FAX (858) 484-9237 * Desk (858) 484-9237
> E-mail:  [EMAIL PROTECTED] * Web http://www.gers.com
> "e-Business Solutions for the Consumer-Driven World"

************************************************************************
* Rose Forum is a public venue for ideas and discussions.
* For technical support, visit http://www.rational.com/support
*
* Admin.Subscription Requests: [EMAIL PROTECTED]
* Archive of messages:
http://www.rational.com/products/rose/usergroups/rose_forum.jtmpl
* 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
*
* Admin.Subscription Requests: [EMAIL PROTECTED]
* Archive of messages: 
http://www.rational.com/products/rose/usergroups/rose_forum.jtmpl
* 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