-
Notifications
You must be signed in to change notification settings - Fork 2
/
create-color-versions.vbs
75 lines (60 loc) · 1.9 KB
/
create-color-versions.vbs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
'create color versions using actions from Adobe Illustrator
'
'
'
'TO DO: check to see if the app is running
'wait to start processing images until after the application is ready.
'get the file name dynamically from the web app.
'see Adobe scripting guide for more information:
'http://www.adobe.com/devnet/illustrator/scripting.html
Option Explicit
Dim appRef
Set appRef = CreateObject("Illustrator.Application")
appRef.UserInteractionLevel = -1
Dim logoID
logoID = "C:\test\TEST-Elect-Colle-H-BG-RGB"
Dim fileName
fileName = logoID + ".svg"
Dim saveOptions
Set saveOptions = CreateObject("Illustrator.EPSSaveOptions")
saveOptions.CMYKPostScript = True
Dim saveOptionsPDF
Set saveOptionsPDF = CreateObject("Illustrator.PDFSaveOptions")
'Call the convertColor sub for each color mode
'Each colorMode sent needs to have an associated action in Illustrator
convertColor "BG-CMYK-C"
convertColor "BG-CMYK-U"
convertColor "BG-PMS-110C"
convertColor "BG-PMS-7405U"
convertColor "WG-CMYK-C"
convertColor "WG-CMYK-U"
convertColor "WG-PMS-110C"
convertColor "WG-PMS-7405U"
convertColor "W-CMYK"
convertColor "B-CMYK"
'Close Adobe Illustrator
appRef.Quit
Sub convertColor(colorMode)
'opens the file
'runs the conversion actions
'edits the path/filename
'saves the file
'closes the original without saving
'open the document with Illustrator
Dim docRef
Set docRef = appRef.Open(fileName)
'Run the Illustrator action on the active file
'Call using the format: (action name, action set)
'docRef.DoScript (colorMode, "Convert Colors")
appRef.DoScript colorMode, "Convert Colors"
'Create the new file name by inserting the color mode text
Dim newFileName
newFileName = logoID + colorMode + ".eps"
Dim pdfFileName
pdfFileName = logoID + colorMode + ".pdf"
'Save the eps and pdf file
docRef.SaveAs newFileName, saveOptions
docRef.SaveAs pdfFileName, saveOptionsPDF
'Close the svg file without saving
docRef.Close
End Sub