filter illustrator 10 eps file

Hi All
I want a program in which following three actions shoud be performed.

  1. Fill over print black 100% with fill and stroke.
    
  2. Delete any extras dots or anything, that should be delete.
    
  3. set swatche to  {name:"My Swatch", color:{red:175.0, green:50.0, blue:0.0}.
    

Regards

Rajeev

So? Where are you getting stuck?

See, this is the first time when i am scripting for Illustrator.

when I write
3. make new swatch with properties {name:“My Swatch”, color:{red:175.0, green:50.0, blue:0.0}.
2. I really cofused how I identify those things

  1. Give some idea only
    

i want just only ideas.

Regards,
Rajeev

Macrajeev,

More info on what you’re trying to do would be helpful but here is what I know. I’m using Illustrator CS so I don’t know if it will work quite the same in 10. Open the dictionary for Illustrator 10 when you have script editor open. Anyway…

For setting a fill or stroke to overprint -


tell application "Illustrator 10"
set thisDoc to current document
set properties of every path item of thisDoc to {fill overprint:true}
set properties of every path item of thisDoc to {stroke overprint:true}
end tell

This will only work for any item that Illustrator sees as a path item (rectangles, circles, lines, outlined text, etc.)
If you need specific items you need to be able to identify them which leads to a possible problem in as far as deleting any “dots” or anything else you need to delete.

As this script is written it assumes a document is open. You may need to add code to make it open specific files.

For setting colors -


tell application "Illustrator 10"
activate
make new document with properties {height:864,width:864, color space:RGB}
set thisDoc to current document
make new swatch at end of current document with properties {name:"My Swatch", color:{red:175, green:50, blue:0}}
end tell

If you haven’t already found it there is a downloadable pdf of the Illustrator scripting guide on the Adobe website. (At least I think that is where I got it). Hope this gets you started.

Model: G5 dual 1.8
AppleScript: 1.9.3
Browser: Safari 125.12
Operating System: Mac OS X (10.3.8)

Thanks, but I am also never developed any script for any Illustrator.

Your support really appresiable. But it is not working at all.
Regards,
Rajeev

Macrajeev,

What are you trying to do with your script? Are you trying to open a file and work with that file’s contents or are you trying to make a new document and place items in it?

PreTech

Yes Users are opening a file and execute an action which User has created. Now first let me clear.

They opens a file and saved it in latest version and then run the action. What actions perform I allready mention in post in three point just in the root queries.
I have given them a program and as the run it open each file and saved in latest version, But I am uable to run any action through script. So I think what action is doing I will hard code in my program, in this way User will satisfy.
Regards.
Rajeev

Hi Pretech,

Its fine for setting black overprint for each and every file.
can you give me for batch files. i have 100’s of eps files in a folder.
i want to set black overprint for all the eps files in the folder and save as files in new folder.

sunny

Surknal,

Sorry I didn’t check up on my email and had not seen your question. I do not know if you have found your answers to your last question or not but here is the best I can do at the moment.

tell application "Finder"
	set folderToGet to choose folder with prompt "Choose file folder with overprint issues."
	set fileList to every file of folder folderToGet as alias list
	set foldDest to choose folder with prompt "Choose file destination folder."
	repeat with aFile in fileList
		open aFile
		tell application "Illustrator CS"
			set thisDoc to current document
			set selection to (every page item of current document whose fill color is {class:CMYK color info, cyan:0, magenta:0, yellow:0, black:100})
			set properties of selection to {fill overprint:true}
			set selection to (every page item of current document whose stroke color is {class:CMYK color info, cyan:0, magenta:0, yellow:0, black:100})
			set properties of selection to {stroke overprint:true}
			save thisDoc in foldDest with replacing
			close current document saving no
		end tell
	end repeat
end tell

This of course has to open every file and perform operations on each file. Unfortunately I cannot yet figure out how to get it to select all fills or strokes that have a black value between a certain range (such as black:49 to black:100). This only will select black at 100 so if you have a black value of 99 it will not be set to overprint. There are operations for setting up printing to automatically overprint black however.

PreTech

Hello PreTech,

Thanks a lot for your script.

I use:

Mac OS X
Illustrator 10

I have changed Illustrator CS to Illustrator 10 in your script.
I have a problem when i run the script. I got an error that,

“Adobe Illustrator 10 got an error: Can’t make selection into a Item”

In this line i got an error

set selection to (every page item of current document whose fill color is {class:CMYK color info, cyan:0, magenta:0, yellow:0, black:100})

please help me in this regards

thanks in advance,

Sunny

Surknal,

I’ve played around with AI 10. This is what I came up with. Once again remember that this will only work with a black value that you specify. It won’t do all shades of black.

tell application "Finder"
	set folderSource to choose folder with prompt "Choose files for overprint."
	set fileList to every file of folder folderSource as alias list
	set folderDest to choose folder with prompt "Choose folder destination."
	set destPath to folderDest as string
	set fileCount to count folder folderSource
	repeat with aFile in fileList
		set fileName to name of aFile
		set newFilePath to destPath & fileName & ".eps"
		tell application "Adobe Illustrator 10"
			activate
			open aFile
			set itemCount to count of every page item of current document
			repeat with i from 1 to itemCount
				if filled of (page item i) of current document is true then
					if fill color of (page item i) of current document is {class:CMYK color info, cyan:0, magenta:0, yellow:0, black:100} then
						set properties of (page item i) of current document to {fill overprint:true}
					end if
				end if
				if stroked of (page item i) of current document is true then
					set selection to (page item i) of current document
					if stroke color of (page item i) of current document is {class:CMYK color info, cyan:0, magenta:0, yellow:0, black:100} then
						set properties of (page item i) of current document to {stroke overprint:true}
						
					end if
				end if
			end repeat
			save current document in file newFilePath as eps with options {class:EPS save options, compatibility:Illustrator 10, preview:color Macintosh, embed linked files:true, include document thumbnails:true, embed all fonts:true, CMYK PostScript:true, PostScript:level 2} with replacing
			close current document saving no
		end tell
	end repeat
end tell

This worked for me in AI 10. Hope this helps.

PreTech

Hi PreTech,

Thanks a lot. It works fine with the simple art(circle,boxes,etc.,) files which i created by myself.

But, it gives an error with the customer provided art files.

I get error : can’t get filled of page item 1 of current document.

if filled of (page item i) of current document is true then

I would like to attach you some art files, so that you can find what is the problem.
Can you please give me your mail id to attach the art files.

Thanks,
Sunny.

Surknal,

That probably will not be necessary. The problem is more than likely that there are text items in the art. I made some simple art files to play with and came up with the following updated script.

tell application "Finder"
	set folderSource to choose folder with prompt "Choose files for overprint."
	set fileList to every file of folder folderSource as alias list
	set folderDest to choose folder with prompt "Choose folder destination."
	set destPath to folderDest as string
	set fileCount to count folder folderSource
	repeat with aFile in fileList
		set fileName to name of aFile
		set newFilePath to destPath & fileName & ".eps"
		tell application "Adobe Illustrator 10"
			activate
			open aFile
			try
				set textCount to count of every text art item of current document
				repeat with q from 1 to textCount
					set selection to (text art item q) of current document
					set charaCount to count every character of (text art item q) of current document
					repeat with z from 1 to charaCount
						if filled of ((character z) of text art item q) of current document is true then
							if fill color of ((character z) of text art item q) of current document is {class:CMYK color info, cyan:0, magenta:0, yellow:0, black:100} then
								set properties of ((character z) of text art item q) of current document to {fill overprint:true}
							end if
						end if
						if stroked of ((character z) of text art item q) of current document is true then
							if stroke color of ((character z) of text art item q) of current document is {class:CMYK color info, cyan:0, magenta:0, yellow:0, black:100} then
								set properties of ((character z) of text art item q) of current document to {stroke overprint:true}
								
							end if
						end if
					end repeat
				end repeat
			on error
				display dialog "There doesn't seem to be any text items in the current document." giving up after 2
			end try
			
			try
				set pathCount to count of every path item of current document
				repeat with i from 1 to pathCount
					set selection to (path item i) of current document
					if filled of (path item i) of current document is true then
						if fill color of (path item i) of current document is {class:CMYK color info, cyan:0, magenta:0, yellow:0, black:100} then
							set properties of (path item i) of current document to {fill overprint:true}
						end if
					end if
					if stroked of (path item i) of current document is true then
						set selection to (path item i) of current document
						if stroke color of (path item i) of current document is {class:CMYK color info, cyan:0, magenta:0, yellow:0, black:100} then
							set properties of (path item i) of current document to {stroke overprint:true}
							
						end if
					end if
				end repeat
			on error
				display dialog "There doesn't seem to be any path items in the current document." giving up after 2
			end try
			save current document in file newFilePath as eps with options {class:EPS save options, compatibility:Illustrator 10, preview:color Macintosh, embed linked files:true, include document thumbnails:true, embed all fonts:true, CMYK PostScript:true, PostScript:level 2} with replacing
			close current document saving no
		end tell
	end repeat
end tell

This woked well on my computer with text that had multiple colors, some stroked, some not, some stroked with different color, objects with multiple colors etc.

Try working with this to see if you can modify it for your needs.

PreTech

I’m late to the game, too busy at work and didnt see the topic earlier. Ahyway I may be stating the obvious, which may have been overlooked, but the fastest way to do this may be so set up an action in Illustrator to select all and run the filter>colors>overprint black with the appropriate settings, then just batch open the files and run the action via a doscript command. This is going to work faster than processing individual page items and should work with fills, strokes, and text as long as the action is set up properly. Then save as and move on to the next file.

Jerome & Surknal,

I’ve not used the actions in Illustrator before. Here is a script using the actions. However, applescript in AI 10 does not allow selecting all items in a page (or maybe there is another way) when you write

set selection to every page item of current document.

This works in AI CS, but in AI CS, when using the action, does not perform the action on everything if it includes text. (buggy)

So this script still has to select every item one at a time and dialogs will still pop up if there are different colors (which can be tested for in the script before applying the action). Also when setting up the action for overprinting you’re still faced with selecting a certain percentage of black, such as 100% or 93% and so on, that you specify so only that percentage is set to overprint.

So here is the script I came up with.

tell application "Finder"
	set folderSource to choose folder with prompt "Choose files for overprint."
	set fileList to every file of folder folderSource as alias list
	set folderDest to choose folder with prompt "Choose folder destination."
	set destPath to folderDest as string
	set fileCount to count folder folderSource
	repeat with aFile in fileList
		set fileName to name of aFile
		set newFilePath to destPath & fileName & ".eps"
		tell application "Adobe Illustrator 10"
			activate
			open aFile
			set objectCount to count of every page item of current document
			repeat with i from 1 to objectCount
				set selection to page item i of current document
				-- this is an action set up in AI10. You have to make sure that your names from your actions are EXACTLY the same as in your script. The first name is the action and the second name is the action set.
				do script "Untitled -1" from "OverprintBlack" without dialogs
			end repeat
			save current document in file newFilePath as eps with options {class:EPS save options, compatibility:Illustrator 10, preview:color Macintosh, embed linked files:true, include document thumbnails:true, embed all fonts:true, CMYK PostScript:true, PostScript:level 2} with replacing
			close current document saving no
		end tell
	end repeat
end tell

Also to Surknal, I don’t know if you know this but you can select black to overprint from the print dialog when you’re printing separations from AI 10.

PreTech

Hello PreTech,

Thanks a lottttttt…

It works fine.

Regards,
Sunny