I try to save Illustrator Ai/EPS files as PDF with different options like as:
-- i try to set options for color/grayscale compression
if chkImagesCompression as text = "Minimum" then
set myCompression to "automatic JPEG minimum" as text
else if chkImagesCompression as text = "Low" then
set myCompression to "automatic JPEG low" as text
else if chkImagesCompression as text = "Medium" then
set myCompression to "automatic JPEG medium" as text
else if chkImagesCompression as text = "High" then
set myCompression to "automatic JPEG high" as text
else if chkImagesCompression as text = "Maximum" then
set myCompression to "automatic JPEG maximum" as text
end if
...
-- then i try substitute variable myCompression to save options
save current document in file pdfName as pdf ¬
with options {class:PDF save options, compatibility:Acrobat 5, preserve editability:false, color compression:myCompression, color downsampling:filesResolution, color downsampling threshold:(filesResolution + 24 as integer), color resample:bicubic downsample, grayscale compression:myCompression, grayscale downsampling:filesResolution, grayscale downsampling threshold:(filesResolution + 24 as integer), grayscale resample:bicubic downsample, bleed link:false, optimization:true}
And got an error “ “Error in exportPDF: -1700. Adobe Illustrator got an error: Can’t make some data into the expected type.”
But if i write as “color compression:automatic JPEG medium,” all work well. What should i do for solve that issue?
the compression values are enumerated constants, not text. The difference is: no double quotes.
Try this
if chkImagesCompression as text = "Minimum" then
set myCompression to automatic JPEG minimum
else if chkImagesCompression as text = "Low" then
set myCompression to automatic JPEG low
else if chkImagesCompression as text = "Medium" then
set myCompression to automatic JPEG medium
else if chkImagesCompression as text = "High" then
set myCompression to automatic JPEG high
else if chkImagesCompression as text = "Maximum" then
set myCompression to automatic JPEG maximum
end if
My understanding is that these are value making sense only in a tell application “Adobe Illustrator” block.
So I guess that the code below, in fact, stefan’s one encapsulated in the named block will compile.
tell application "Adobe Illustrator"
if chkImagesCompression as text = "Minimum" then
set myCompression to automatic JPEG minimum
else if chkImagesCompression as text = "Low" then
set myCompression to automatic JPEG low
else if chkImagesCompression as text = "Medium" then
set myCompression to automatic JPEG medium
else if chkImagesCompression as text = "High" then
set myCompression to automatic JPEG high
else if chkImagesCompression as text = "Maximum" then
set myCompression to automatic JPEG maximum
end if
end tell
Yvan KOENIG running Yosemite 10.10.5 in French (VALLAURIS, France) mardi 29 septembre 2015 14:12:33