Connector Macro Help

Discussion in 'Perl Misc' started by joey_costanza@msn.com, Nov 15, 2007.

  1. Guest

    Hello Everyone,
    I am very stuck and I was wondering if any of you could give me a
    hand. I'm trying to write a Perl or VB script to connect some
    rectangles in Visio with a 'connector'. I have found there is very
    little help online in the way of making Visio macros with Perl. I have
    found Perl can translate directly in to Visual Basic in most cases by
    substituting "->" in for ".". For some reason, however, I am not able
    to say

    $Visio->ActivePage->Drop($Visio->ConnectorToolDataObject, 2, 2);
    where $Visio is the Visio Application. I am using the Win32::OLE
    library by the way.

    Fortunatly, I am able to connect the shapes with the connector by
    having it select the two rectangles and using

    $Visio->ActiveWindow->Select($square1, 2);
    $Visio->ActiveWindow->Select($square2, 2);
    $Visio->ActiveWindow->Selection->ConnectShapes;

    Anyway...my main goal is to change the color of the connector. Is
    there anyway to do this by way of the method I am using. I think I
    need to set the connector it created equal to a variable somehow, that
    way I can use the $connector->cells("LineColor")->{Formula} = color. I
    am not currently sure how to define it. I was hoping one of you would
    know some clever way to do it. If you know how to do this in VB,
    without using the Drop way I would REALLY appriciate it, and hopefully
    I will be able to translate it to Perl. I've been going around in
    circles about this for days. If you know how to use the Drop way I
    talked about above in Perl, first, you are awesome, second can you
    please tell me how?

    If you know the answer to this, seriously you are a genious.
    Thanks,
    Joe
    , Nov 15, 2007
    #1
    1. Advertising

  2. Paul Herber Guest

    On Thu, 15 Nov 2007 08:54:29 -0800 (PST), wrote:

    >Hello Everyone,
    >I am very stuck and I was wondering if any of you could give me a
    >hand. I'm trying to write a Perl or VB script to connect some
    >rectangles in Visio with a 'connector'. I have found there is very
    >little help online in the way of making Visio macros with Perl. I have
    >found Perl can translate directly in to Visual Basic in most cases by
    >substituting "->" in for ".". For some reason, however, I am not able
    >to say
    >
    >$Visio->ActivePage->Drop($Visio->ConnectorToolDataObject, 2, 2);
    >where $Visio is the Visio Application. I am using the Win32::OLE
    >library by the way.
    >
    >Fortunatly, I am able to connect the shapes with the connector by
    >having it select the two rectangles and using
    >
    >$Visio->ActiveWindow->Select($square1, 2);
    >$Visio->ActiveWindow->Select($square2, 2);
    >$Visio->ActiveWindow->Selection->ConnectShapes;


    The ConnectShapes method will return an object, the shape object of
    your new connector. This will be your $connector.
    (I haven't tried or checked this.)

    >Anyway...my main goal is to change the color of the connector. Is
    >there anyway to do this by way of the method I am using. I think I
    >need to set the connector it created equal to a variable somehow, that
    >way I can use the $connector->cells("LineColor")->{Formula} = color.


    use an RGB(r,g,b) string for your colour.


    --
    Regards, Paul Herber, Sandrila Ltd.
    Electronics for Visio http://www.electronics.sandrila.co.uk/
    Paul Herber, Nov 15, 2007
    #2
    1. Advertising

  3. Guest

    > The ConnectShapes method will return an object, the shape object of
    > your new connector. This will be your $connector.
    > (I haven't tried or checked this.)
    >
    > >Anyway...my main goal is to change the color of the connector. Is
    > >there anyway to do this by way of the method I am using. I think I
    > >need to set the connector it created equal to a variable somehow, that
    > >way I can use the $connector->cells("LineColor")->{Formula} = color.

    >
    > use an RGB(r,g,b) string for your colour.
    >
    > --
    > Regards, Paul Herber, Sandrila Ltd.
    > Electronics for Visio http://www.electronics.sandrila.co.uk/- Hide quoted text -


    Thanks for the quick reply Paul, but according to the VB help (and
    many trials and failures on my part) the ConnectShapes method doesn't
    return anything. Do you know of another way I could make a variable
    equal to the connector that is created?
    Thanks,
    Joe
    , Nov 15, 2007
    #3
  4. Paul Herber Guest

    On Thu, 15 Nov 2007 12:49:17 -0800 (PST), wrote:

    >> The ConnectShapes method will return an object, the shape object of
    >> your new connector. This will be your $connector.
    >> (I haven't tried or checked this.)
    >>
    >> >Anyway...my main goal is to change the color of the connector. Is
    >> >there anyway to do this by way of the method I am using. I think I
    >> >need to set the connector it created equal to a variable somehow, that
    >> >way I can use the $connector->cells("LineColor")->{Formula} = color.

    >>
    >> use an RGB(r,g,b) string for your colour.



    >Thanks for the quick reply Paul, but according to the VB help (and
    >many trials and failures on my part) the ConnectShapes method doesn't
    >return anything. Do you know of another way I could make a variable
    >equal to the connector that is created?


    Well, you might be better off using the Drop method with a suitable
    connector master. The Visio SDK has examples of this. The Drop method
    certainly returns a shape object.



    --
    Regards, Paul Herber, Sandrila Ltd.
    DFD for Visio http://www.gane-sarson.sandrila.co.uk/
    Paul Herber, Nov 15, 2007
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Dead RAM
    Replies:
    20
    Views:
    1,088
    John Harrison
    Jul 14, 2004
  2. D Senthil Kumar

    macro name from macro?

    D Senthil Kumar, Sep 20, 2003, in forum: C Programming
    Replies:
    1
    Views:
    563
    Jack Klein
    Sep 21, 2003
  3. Ian S. Nelson

    PostgreSQL connector and Zope connector

    Ian S. Nelson, Jul 26, 2004, in forum: Python
    Replies:
    2
    Views:
    437
    Lee Harr
    Jul 27, 2004
  4. sounak

    to get macro name from macro value

    sounak, Nov 22, 2005, in forum: C Programming
    Replies:
    17
    Views:
    483
    Mark McIntyre
    Nov 22, 2005
  5. carmelo
    Replies:
    8
    Views:
    1,406
    Roland de Ruiter
    Oct 12, 2008
Loading...

Share This Page