3 Replies Latest reply on Nov 4, 2013 1:23 PM by ThinkingThings

    VB Syntax Help for Pathpoint Anchor

    ThinkingThings Level 1

      Greetings, Friends!

       

      I think that I am about to slap myself silly, as I know that as soon as I am presented the solution, I'll do one of those "Dang - I knew that", but after a few hours of trying, I'm currently coming up empty.

       

      Here's the problem: I am trying to (among other things) move a pathpoint that was added on a pathitem rectangle. The add of the pathitem goes well, the add of the pathpoint to the rectangle is fine, although when it it is "added" it picks some arbitrary position, hence the need to change the position, starting with the anchor.

       

      I typically write in VB.NET (2013), as I am doing here. Using Illustrator CS6.

       

      In VBScript, documentation shows:

          newPoint.Anchor = Array(75, 300)

      Using that syntax, I get a pre-complier error in VB.NET, as "Array" is a type and can't be used as an expression.

       

      To create an inline array in VB.NET, I would normally use:

          newPoint.Anchor = {75, 300}

      Using this syntax, I get a runtime COM-exception error.

       

      Any help would be GREATLY appreciated!!!

       

      Thank you in advance,

       

      TT

        • 1. Re: VB Syntax Help for Pathpoint Anchor
          ThinkingThings Level 1

          Greetings! Wow - what a difference a good night's sleep makes.So  I guess I get to answer my own thread. Sure is lonely out here...

           

          Maybe someone else can use this info (if there "IS" anyone else out there who uses VB.NET with AI Scripting).

           

          So... in VB.NET, this does NOT work either:

           

               Dim newArray As Array = {x, y}

          nor this:

               Dim newArray As Object = {x, y}

           

          However, doing a "long-handed" array does (I simply created a function):

              

               pathPoint.Anchor = Array(123.123, -012.012)

           

               Private Function Array(x As Double, y As Double) As Object

                    Dim newArray(1) '2 screen position points

                    newArray(0) = x

                    newArray(1) = y

                    Return newArray

               End Function

           

          Not sure why .NET with AI Scripting is so touchy... Hope this helps someone.

           

          -TT

           

           

           

           

           

          • 2. Re: VB Syntax Help for Pathpoint Anchor
            CarlosCanto Adobe Community Professional & MVP

            good, thanks for posting the solution

             

            how about this (I wouldn't know how to try vb.net)

             

            newPoint.Anchor = [{75, 300}]

            • 3. Re: VB Syntax Help for Pathpoint Anchor
              ThinkingThings Level 1

              Hi Carlos,

               

              Gave it a try and the precompiler prompts an error "End of Statement expected". Tried inverting the positions of the braces and square brackets, but got the same error. Thanks you very much, though, for the suggestion -- it was surely worth a try!

               

              Which leads me to my next thought -- I think that you and I should get together -- say at the upcoming Adobe Scripting Forum Christmas Party (which I am sure that you are busily preparing and making arrangements for the guest speakers, etc., etc...) --- and I'll teach you VB.NET and you can teach me VBScript? What do you think?!?

               

              Thanks again, my friend, for the suggestion.

               

              -TT