Copy link to clipboard
Copied
Hello,
I rewrote a JS code in VB. Everthing works fine except the red lines.
I open an eps-file, the script resaves the file as AI (remove the [converted]) and place the file in the same directory as the original eps-file.
A single file with a correct path (eg c:\test.eps -> c:\test.ai) works fine.
Set appRef = CreateObject("Illustrator.Application")
'new inserted
var doc=appRef.ActiveDocument
var destFile = appRef.Documents.add(decodeURI(doc.fullName).replace(/(?: \[Converted\])?\.eps$/, '.ai')) 'also remove "[Converted]" from filename
Set saveOptions = CreateObject("Illustrator.IllustratorSaveOptions")
saveOptions.Compatibility = 15 'Illustrator CS5
saveOptions.EmbedICCProfile=true 'embed ICCprofile
saveOptions.Compressed=true
saveOptions.PDFCompatible=true 'pdf output
appRef.Documents(1).SaveAs (destFile), saveOptions
appRef.Documents(1).Close 2
Set appRef = Nothing
I hope someone can help me
Yes, that means you shouldn't run it through menu, you can just double click the vbs file to launch it.
Copy link to clipboard
Copied
Aha, get it work. And for you another post, I add the execute action part for you, so you should create a "Convert to grayscale" action in the "Default Actions" set.
Set appRef = CreateObject("Illustrator.Application") appRef.DoScript "Convert to grayscale", "Default Actions" 'WHILE(appRef.ActionIsRunning) WScript.sleep 5000 'WEND Set saveOptions = CreateObject("Illustrator.IllustratorSaveOptions") saveOptions.Compatibility = 15 'Illustrator CS5 saveOptions.EmbedICCProfile=true 'embed ICCprofile saveOptions.Compressed=true saveOptions.PDFCompatible=true 'pdf output appRef.Documents(1).SaveAs(appRef.DoJavaScript("decodeURI(app.activeDocument.fullName).replace(/(?: \[Converted\])?\.eps$/, '.ai');")), saveOptions appRef.Documents(1).Close 2 Set appRef = Nothing
Copy link to clipboard
Copied
Great about the calling procedure for "saving"!
1 problem: the doscript doesn't work.
I created an action: test in default actions, I runned the vbs-script by File>script>other script>open the vbs-script and then I get an error:
"The do script command cannot be executed from the scripts menu"
I read in the reference guide:
Plays an action from the Actions palette.
Note:
Use DoScript only if you intend to run your script from an application external to Illustrator, such as the Windows® Script Host.
Calling DoScript when running a script from Illustrator’s File > Scripts menu may yield unexpected results.
Other suggestions to solve this problem?
Copy link to clipboard
Copied
Yes, that means you shouldn't run it through menu, you can just double click the vbs file to launch it.
Copy link to clipboard
Copied
Not script advise but a general comment… [Converted] is a switchable app pref…
Copy link to clipboard
Copied
That's the solution!
Thanks
Now, a new job for adobe: rewrite the manual in "newbie" language.
Copy link to clipboard
Copied
If they do then I will consider myself for the download…