Skip to main content
Participant
March 28, 2011
Question

Is this possible? Using Illustrator Script to duplicate EPS file 35 times & changing C,M,Y,K value?

  • March 28, 2011
  • 2 replies
  • 1191 views

Hi everyone,

I need HELP I have a bunch of vector clip arts, which are Black (C,M,Y,K100). I need it in 35 different colors Saved as Illustrator 8 EPS and I also need those file in 72 DPI PNG Transparent files.

Thanks for any help.

Akkudo.

This topic has been closed for replies.

2 replies

Patrice Brel
Inspiring
April 7, 2011

Good evening,

0) In your templates give a specific namme to each path or groups or items via the layers window.

     The objective is to use a script like these two:

    Set myLayerCercle = my_Laieur_elements.GroupItems("Laplupart").PathItems("LaplupartCercle")
        myAiApp.Redraw
        myLayerCercle.FillColor.Spot.Color.Cyan = 0
        myLayerCercle.FillColor.Spot.Color.Magenta = 100
        myLayerCercle.FillColor.Spot.Color.Yellow = 80
         myLayerCercle.FillColor.Spot.Color.Black = 0
       myAiApp.Redraw

or

  textRef.Paragraphs.Add ("myNewText")
    textRef.Paragraphs(1).ParagraphAttributes.Justification = aiRight
    textRef.Paragraphs(1).CharacterAttributes.Size = 12
    textRef.Paragraphs(1).CharacterAttributes.HorizontalScale = 10
    textRef.TextRange.CharacterAttributes.BaselineShift = fontBaseLineShift

    textRef.TextRange.CharacterAttributes.TextFont = myAiApp.TextFonts.Item("Times")

    textRef.TextRange.CharacterAttributes.FillColor.Black = 0
    textRef.TextRange.CharacterAttributes.FillColor.Magenta = 100
    textRef.TextRange.CharacterAttributes.FillColor.Yellow = 0
    textRef.TextRange.CharacterAttributes.FillColor.Cyan = 0

If you agree please send your eps file via my email. I could be than more efficient.

Have a good evening

Patrice

*) open an office sofware (Word or Excel) and go to the Visual basic editor (alt+F11) and

copy and paste these script; replace nom_docAi  with your eps file name

Public nom_docAi

Sub myPrg()

call OpenAi

call openBaseFile                          '= open the eps file

call myRectangle(100,100,200,300)

call saveEPS(nom_docAi )

call savePNG(nom_docAi )

end sub

Sub OpenAi()
'*** le fichier excel et illustrator se trouvent dans le même répertoire
myPath = ActiveWorkbook.Path

'*** Définition de la variable "application"
Set myAiApp = CreateObject("Illustrator.Application.CS4")
End Sub

Sub openBaseFile()
'*** Définition et ouverture du fichier illustrator de base
nom_eps = "cycle.eps"
'nom_docAi = myPath & "\" & nom_eps
nom_docAi = "G:\graph" & "\" & nom_eps
Set myDocAi = myAiApp.Open(nom_docAi, 1)
End Sub

Sub saveEps(myPictureName)
'*** Sauvegarde fichier
Set myDocAi = myAiApp.ActiveDocument
Set myEpsSave = CreateObject("Illustrator.EPSSaveOptions.CS4")
    myDocAi.CropBox = myDocAi.VisibleBounds
    myEpsSave.EmbedAllFonts = True
    myEpsSave.Preview = aiColorTIFF
    myEpsSave.postscript = ailevel3
    myAiApp.ActiveDocument.SaveAs myPictureName, myEpsSave
   
End Sub

sub myRectangle(x, y, LenghRect, HeightRect)
'*** Sélection du calque recevant les rectangles
Set Laieur = docAi.layers("data")
myAiApp.Redraw

Set myRect = docAi.PathItems.Rectangle(y, x, LenghRect, HeightRect)
myRect.FillColor.Cyan = 0
myRect.FillColor.Yellow = 100
myRect.FillColor.Magenta = 35
myRect.FillColor.Black = 0
myRect.Stroked = False
myAiApp.Redraw

'mTab = myCColor(mType)

End Function

Sub savePNG(myPictureName)
'*** Sauvegarde fichier
myPictureName = Replace(myPictureName, ".eps", ".png")
Set myAiApp = CreateObject("Illustrator.Application.CS4")
Set docAi = myAiApp.ActiveDocument
Set pngExportOptions = CreateObject("Illustrator.ExportOptionsPNG24.CS4")
pngExportOptions.AntiAliasing = True
pngExportOptions.Transparency = True
docAi.Export myPictureName, aiPNG24, pngExportOptions

End Sub

Patrice Brel
Inspiring
April 6, 2011

Good morning,

If you work on pc and have ms office and have some script for you.

Patrice