Mismatch type Illustrator 32bit and 64 bit
I am running a script for the last 10 years without problem and suddenly it doesn't work
This script do not work on Illustrator 64 bit but no problem on illustrator 32 bit until last week, no library or reference missing.
Maybe somebody may help me to solve this problem below, in reality I have hundred of script with the same mismatch type error
THE ERROR IS ON THIS LINE BELOW set FirstMi2 = PointMi2(Ligne) ' ERROR MISMATCH TYPE
Sub length2()
Dim Ligne As Long
Dim FirstMi2 As Illustrator.PathPoint 'if I write only Dim FirstMi2 then the same error will be at the next line Set NextMi2 = PointMi2(Ligne + 1)
Dim NextMi2 As Illustrator.PathPoint 'if I write only Dim NextMi2 then the same error will be at the next line dPoint1X = FirstMi2.Anchor(0)
Dim numPointMi2 As Double
Dim EachLength As Double
Dim TotalLength As Double
Dim dPoint1X As Double 'if I write only Dim dPoint1X then the same error will be at the next line dPoint1Y = FirstMi2.Anchor(1)
'If I do not dim all point as Double then I cannot use my Public Function BezierLength(dPoint1X As Double, ....
Dim dPoint1Y As Double
Dim dPoint2X As Double
Dim dPoint2Y As Double
Dim dPoint3X As Double
Dim dPoint3Y As Double
Dim dPoint4X As Double
Dim dPoint4Y As Double
Dim appRef
Set appRef = CreateObject("Illustrator.Application.CS6")
Set docRef = appRef.ActiveDocument
Set LayerRef1 = docRef.ActiveLayer()
If Not IsEmpty(appRef.Selection) Then
mySelection = appRef.Selection
endIndex = UBound(mySelection)
startIndex = LBound(mySelection)
TotalLength = 0
For i = startIndex To endIndex
Set MyPathItem = mySelection(i)
Set PointMi2 = MyPathItem.PathPoints
numPointMi2 = PointMi2.Count
For Ligne = 1 To (numPointMi2 - 1) Step 1
Set FirstMi2 = PointMi2(Ligne) ' ERROR MISMATCH TYPE
Set NextMi2 = PointMi2(Ligne + 1)
dPoint1X = FirstMi2.Anchor(0)
dPoint1Y = FirstMi2.Anchor(1)
dPoint2X = FirstMi2.RightDirection(0)
dPoint2Y = FirstMi2.RightDirection(1)
dPoint3X = NextMi2.LeftDirection(0)
dPoint3Y = NextMi2.LeftDirection(1)
dPoint4X = NextMi2.Anchor(0)
dPoint4Y = NextMi2.Anchor(1)
EachLength = BezierLength(dPoint1X, dPoint1Y, dPoint2X, dPoint2Y, dPoint3X, dPoint3Y, dPoint4X, dPoint4Y)
TotalLength = TotalLength + EachLength
Next Ligne
Next
MsgBox "Longeur " & (Round((TotalLength / 72), 4)) & " " & "Nombre de points " & numPointMi2 & " " & i & " de " & endIndex
End If
End Sub
Thanks Marcel
