Re: Connector Macro Help

Re: Connector Macro Help

am 15.11.2007 18:18:09 von Paul Herber

On Thu, 15 Nov 2007 08:54:29 -0800 (PST), joey_costanza@msn.com 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/

Re: Connector Macro Help

am 16.11.2007 00:03:27 von Paul Herber

On Thu, 15 Nov 2007 12:49:17 -0800 (PST), joey_costanza@msn.com 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/