NOOBIE needs help scripting Photoshop/Illustrator Actions with an EMAC

Hey Everyone I need help creating a script to run multiple Illustrator Actions then Photoshop Actions. I manage and repurpose hundreds of files using Illustrator and Photoshop, but I want to create an applescript to do all the actions at once instead of doing them individually.

What I want to do is:

  1. Choose from folder “TEMP” on desktop.
  2. Run Illustrator CS action “X” (the action designates files to folders)
    *How do I override dialogue boxes? Ex. A has artwork do you want to delete? YES
  3. Once the files are created from Illustrator CS, I want to get the files created and run Photoshop Actions and assign the files to folder “B”

I am totally new to this, but any sort of help would be greatly appreciated!
This is what I came up with so far (I know it’s a bit off):

tell application “Adobe Illustrator CS”
open file theFile
tell current document
do action “The Action” from “Its Group”
end tell
end tell

Welcome ryo14, can you be a little more descriptive about whats involved in your process as I have batch scripts for both Illustrator and photoshop it may be that these could be utilized in repeat loops to your folders. Are your originals illustrator .ai files processed and saved to a folder as .eps then opened rasterized into photoshop and saved as other format to another folder? What is involved in your actions for both apps?

ryo14,

Here’s some info for the Ill CS part. To make sure the dialogs do not interfere, you need to click (on the action pallette in Illustrator) the box beside the actions if there is an icon in it. This disables dialogs. Unfortunately, I don’t believe that this is scriptable.

tell application "Finder"
	set sourceFolder to choose folder with prompt "Select the folder with files for processing."
	set destFolder to choose folder with prompt "Select the destination folder."
	set fileList to every file of folder sourceFolder as alias list
	set fileCount to count folder sourceFolder
	if fileCount is not 0 then
		repeat with aFile in fileList
			set fName to name of aFile
			set newFilePath to destFolder & fName as string
			tell application "Illustrator CS"
				activate
				open aFile
				do script "theAction" from "set" without dialogs -- this is an action set up in AICS. 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.
				save current document in file newFilePath as eps with options {class:EPS save options, compatibility:Illustrator 9, preview:color Macintosh, embed linked files:false, include document thumbnails:false, embed all fonts:false, CMYK PostScript:true, PostScript:level 2} with replacing -- this is for saving the file as an eps. I don't know what type of file you want to save to.
				close current document saving no
			end tell
		end repeat
	end if
end tell

It’s a start.

PreTech

Hey Mark67 thanks for the reply I hope this helps:

The original files consist of Illustrator CS .ai files with 4 layers.
Layer A: general info. (file name, date, etc.)
Layer B: BW artwork
Layer C: COLOR artwork (same as Layer B)
Layer D: Canvas layer to output files at specified sizes.

Once the .ai files are complete; 4 files are created for finalization from the originals:

  1. eps file
  2. high res grayscale jpeg
  3. large gif file
  4. small gif file

What I do is run two Illustrator Actions and then use Photoshop droplets to make the 2 gif files. Since we use unique fonts in Illustrator, rasterizing the files in Photoshop is too risky since there are so many files. My process goes like this:

Step 1: First open the files and hide layers A and C and save. Then I run an action that exports the files as an eps file and a high res BW jpeg at 300 dpi to specified folders on the desktop “EPS” and “BW”

Step 2: I run the second action that sources the original ai files to export low res RGB jpegs at 72 dpi. In order to do this I delete layers A and B first. The annoying thing is I get a dialogue box for every file and I have to hit enter every time! The files are then placed on specified folders on my desktop “LG” and “SM”

Step 3: Once all the files have been made I go to Photoshop and use a droplet to make the gif files (large and small).

Ultimately what I would like to do is to be able to use an applescript to do all these things at once without having to deal with the dialogue boxes in Illustrator CS.

Please let me know if I am missing something… Thanks so much PreTech I will go ahead and give that a try!

Ryo14, I see no reason why this whole process can’t be handled in one complete script. It requires a few repeat loops but all pretty standard to what I have in some of mine. A few more questions your origianal .ai files is that the names and stacking order top to bottom of the layers for all files? if so this should make things a bit easier to process. What are the sizes of your colour GIF’s large & small in pixels height & width. I have yet to have a problem with fonts if they are open for illustrator to use in the file then embedding them in the .eps should work fine. Do you mind if we try this first? Heres what I have so far just needs a bit of fine tuning.

set inputFolder to choose folder with prompt "Where is folder the Temp."

tell application "Finder"
	set filesListA to files in inputFolder
	set MyFolderA to make new folder at inputFolder with properties ¬
		{name:"Colour Illustrator EPS"}
	set MyFolderB to make new folder at inputFolder with properties ¬
		{name:"Mono Illustrator EPS"}
	set MyFolderC to make new folder at inputFolder with properties ¬
		{name:"Photoshop Mono JPEG"}
	set MyFolderD to make new folder at inputFolder with properties ¬
		{name:"Photoshop Large GIF"}
	set MyFolderE to make new folder at inputFolder with properties ¬
		{name:"Photoshop Small GIF"}
end tell

repeat with aFile in filesListA
	
	set fileIndex to 0
	
	tell application "Finder"
		set theFile to aFile as alias
	end tell
	
	tell application "Illustrator CS"
		activate
		open theFile with options {update legacy text:true} without dialogs --You may want to set to {update legacy text:false}
		set docRef to the current document
		tell the current document
			
			do script "Delete Unused Palette Items" from "Default Actions" without dialogs
			do script "Delete Unused Palette Items" from "Default Actions" without dialogs
			
			-- The two lines above clean out all the rubbish from the palettes don't ask why it needs to run twice I have no idea.
			
			-- We need to delete the layers A & B here
			
			set docName to name of docRef
			set docBaseName to getBaseName(docName) of me
			set newFileName to (MyFolderA as string) & docBaseName & "_Colour" & ".eps"
		end tell
		
		save docRef in file newFileName as eps with options ¬
			{class:EPS save options, preview:color Macintosh, overprint:discard, embed all fonts:true, embed linked files:true, include document thumbnails:true, compatible gradient printing:false, CMYK PostScript:true, PostScript:level 2}
		
		close current document without saving
	end tell
end repeat

repeat with aFile in filesListA
	
	set fileIndex to 0
	
	tell application "Finder"
		set theFile to aFile as alias
	end tell
	
	tell application "Illustrator CS"
		activate
		open theFile with options {update legacy text:true} without dialogs --You may want to set to {update legacy text:false}
		set docRef to the current document
		tell the current document
			
			do script "Delete Unused Palette Items" from "Default Actions" without dialogs
			do script "Delete Unused Palette Items" from "Default Actions" without dialogs
			
			-- Dito here.
			
			-- We need to delete the layers A & C here
			
			set docName to name of docRef
			set docBaseName to getBaseName(docName) of me
			set newFileName to (MyFolderB as string) & docBaseName & "_Mono" & ".eps"
		end tell
		
		save docRef in file newFileName as eps with options ¬
			{class:EPS save options, preview:color Macintosh, overprint:discard, embed all fonts:true, embed linked files:true, include document thumbnails:true, compatible gradient printing:false, CMYK PostScript:true, PostScript:level 2}
		
		close current document without saving
	end tell
end repeat

tell application "Finder"
	set filesListB to files in MyFolderB
end tell

tell application "Adobe Photoshop CS"
	set display dialogs to never
	close every document saving no
end tell

repeat with aFile in filesListB
	
	set fileIndex to 0
	
	tell application "Finder"
		set theFile to aFile as alias
	end tell
	
	tell application "Adobe Photoshop CS"
		
		set ruler units of settings to pixel units
		
		set background color to {class:RGB color, red:255, green:255, blue:255}
		
		open theFile as EPS with options ¬
			{class:EPS open options, mode:grayscale, resolution:300, use antialias:true, constrain proportions:true}
		
		set docRef to the current document
		tell the current document
			
			set docName to name of docRef
			set docBaseName to getBaseName(docName) of me
			set newFileName to (MyFolderC as string) & docBaseName
		end tell
		
		save docRef in file newFileName as JPEG with options ¬
			{embed color profile:false, quality:9} appending lowercase extension with copying
		
		close current document without saving
	end tell
end repeat

tell application "Finder"
	set filesListC to files in MyFolderA
end tell

tell application "Adobe Photoshop CS"
	set display dialogs to never
	close every document saving no
end tell

repeat with aFile in filesListC
	
	set fileIndex to 0
	
	tell application "Finder"
		set theFile to aFile as alias
	end tell
	
	tell application "Adobe Photoshop CS"
		
		set ruler units of settings to pixel units
		
		set background color to {class:RGB color, red:255, green:255, blue:255}
		
		open theFile as EPS with options ¬
			{class:EPS open options, mode:RGB, resolution:72, use antialias:true, constrain proportions:true}
		
		set docRef to the current document
		
		tell the current document
			
			flatten
			
			set docName to name of docRef
			set docBaseName to getBaseName(docName) of me
			set newFileName to (MyFolderD as string) & docBaseName & "_LG"
		end tell
		
		save docRef in file newFileName as CompuServe GIF with options ¬
			{colors in palette:256, dither:none, forced colors:web, matte:none, palette:local selective, preserve exact colors:false, transparency:true} appending lowercase extension with copying
		
		tell the current document
			resize image height 200 resolution 72 resample method bicubic sharper -- This will be to your choice
		end tell
		
		set newFileName to (MyFolderE as string) & docBaseName & "_SM"
		
		save docRef in file newFileName as CompuServe GIF with options ¬
			{colors in palette:256, dither:none, forced colors:web, matte:none, palette:local selective, preserve exact colors:false, transparency:true} appending lowercase extension with copying
		
		close current document without saving
	end tell
end repeat

-- Returns the document name without extension (if present)
on getBaseName(fName)
	set baseName to fName
	repeat with idx from 1 to (length of fName)
		if (item idx of fName = ".") then
			set baseName to (items 1 thru (idx - 1) of fName) as string
			exit repeat
		end if
	end repeat
	return baseName
end getBaseName

Ryo14, here goes. Strimmed down a bit and the illustrator layer stuff now included. This works sweet at my end.

set inputFolder to choose folder with prompt "Where is folder the Temp."
tell application "Finder"
	set filesListA to files in inputFolder
	set MyFolderA to make new folder at inputFolder with properties ¬
		{name:"Colour Illustrator EPS"}
	set MyFolderB to make new folder at inputFolder with properties ¬
		{name:"Mono Illustrator EPS"}
	set MyFolderC to make new folder at inputFolder with properties ¬
		{name:"Photoshop Mono JPEG"}
	set MyFolderD to make new folder at inputFolder with properties ¬
		{name:"Photoshop Large GIF"}
	set MyFolderE to make new folder at inputFolder with properties ¬
		{name:"Photoshop Small GIF"}
end tell
repeat with aFile in filesListA
	set fileIndex to 0
	tell application "Finder"
		set theFile to aFile as alias
	end tell
	tell application "Illustrator CS"
		activate
		open theFile with options {update legacy text:true} without dialogs --You may want to set to {update legacy text:false}
		set docRef to the current document
		tell the current document
			delete layer named "layer A" of docRef -- NO questions asked.
			delete layer named "layer B" of docRef -- NO questions asked.	
			do script "Delete Unused Palette Items" from "Default Actions" without dialogs
			do script "Delete Unused Palette Items" from "Default Actions" without dialogs
			set docName to name of docRef
			set docBaseName to getBaseName(docName) of me
			set newFileName to (MyFolderA as string) & docBaseName & "_Colour" & ".eps"
		end tell
		save docRef in file newFileName as eps with options ¬
			{class:EPS save options, preview:color Macintosh, overprint:discard, embed all fonts:true, embed linked files:true, include document thumbnails:true, compatible gradient printing:false, CMYK PostScript:true, PostScript:level 2}
		close current document without saving
	end tell
end repeat
repeat with aFile in filesListA
	set fileIndex to 0
	tell application "Finder"
		set theFile to aFile as alias
	end tell
	tell application "Illustrator CS"
		activate
		open theFile with options {update legacy text:true} without dialogs --You may want to set to {update legacy text:false}
		set docRef to the current document
		tell the current document
			delete layer named "layer A" of docRef -- NO questions asked.
			delete layer named "layer C" of docRef -- NO questions asked.
			do script "Delete Unused Palette Items" from "Default Actions" without dialogs
			do script "Delete Unused Palette Items" from "Default Actions" without dialogs
			set docName to name of docRef
			set docBaseName to getBaseName(docName) of me
			set newFileName to (MyFolderB as string) & docBaseName & "_Mono" & ".eps"
		end tell
		save docRef in file newFileName as eps with options ¬
			{class:EPS save options, preview:color Macintosh, overprint:discard, embed all fonts:true, embed linked files:true, include document thumbnails:true, compatible gradient printing:false, CMYK PostScript:true, PostScript:level 2}
		close current document without saving
	end tell
end repeat
tell application "Finder"
	set filesListB to files in MyFolderB
end tell
tell application "Adobe Photoshop CS"
	set display dialogs to never
	close every document saving no
end tell
repeat with aFile in filesListB
	set fileIndex to 0
	tell application "Finder"
		set theFile to aFile as alias
	end tell
	tell application "Adobe Photoshop CS"
		set ruler units of settings to pixel units
		set background color to {class:RGB color, red:255, green:255, blue:255}
		open theFile as EPS with options ¬
			{class:EPS open options, mode:grayscale, resolution:300, use antialias:true, constrain proportions:true}
		set docRef to the current document
		tell the current document
			set docName to name of docRef
			set docBaseName to getBaseName(docName) of me
			set newFileName to (MyFolderC as string) & docBaseName
		end tell
		save docRef in file newFileName as JPEG with options ¬
			{embed color profile:false, quality:9} appending lowercase extension with copying
		close current document without saving
	end tell
end repeat
tell application "Finder"
	set filesListC to files in MyFolderA
end tell
tell application "Adobe Photoshop CS"
	set display dialogs to never
	close every document saving no
end tell
repeat with aFile in filesListC
	set fileIndex to 0
	tell application "Finder"
		set theFile to aFile as alias
	end tell
	tell application "Adobe Photoshop CS"
		set ruler units of settings to pixel units
		set background color to {class:RGB color, red:255, green:255, blue:255}
		open theFile as EPS with options ¬
			{class:EPS open options, mode:RGB, resolution:72, use antialias:true, constrain proportions:true}
		set docRef to the current document
		tell the current document
			flatten
			set docName to name of docRef
			set docBaseName to getBaseName(docName) of me
			set newFileName to (MyFolderD as string) & docBaseName & "_LG"
		end tell
		save docRef in file newFileName as CompuServe GIF with options ¬
			{colors in palette:256, dither:none, forced colors:web, matte:none, palette:local selective, preserve exact colors:false, transparency:true} appending lowercase extension with copying
		tell the current document
			resize image height 200 resolution 72 resample method bicubic sharper -- This will be to your choice
		end tell
		set newFileName to (MyFolderE as string) & docBaseName & "_SM"
		save docRef in file newFileName as CompuServe GIF with options ¬
			{colors in palette:256, dither:none, forced colors:web, matte:none, palette:local selective, preserve exact colors:false, transparency:true} appending lowercase extension with copying
		close current document without saving
	end tell
end repeat

-- Returns the document name without extension (if present)
on getBaseName(fName)
	set baseName to fName
	repeat with idx from 1 to (length of fName)
		if (item idx of fName = ".") then
			set baseName to (items 1 thru (idx - 1) of fName) as string
			exit repeat
		end if
	end repeat
	return baseName
end getBaseName

Hey Mark67 that script you made is awesome:)! I never thought this process of making files could be any easier! The order of the layers are correct:

  1. layer A
  2. layer B
  3. layer C
  4. layer D

What I would like to do is source all the .ai files from a folder from my desktop “1” and then create all the folders and files in that folder just like how you have it above. As far as the specific specs. for the files rendered goes they are as follows:

Folder Name & Specs:

  1. Folder Name: EPS (layers A & C hidden and exported as an .eps file)
    Specs: Append File Extensioin-yes, Lower Case-yes, Compatibility-version 9.0, Preview-TIFF (B&W), Include Document Thumbnails-yes, Include Document Fonts-yes, CMYK Postscript-yes, Postscript-level 2

  2. Folder Name: BW (layers A & C hidden and exported as a BW high res jpeg)
    Specs: Append File Extensioin-yes, Lower Case-yes, Quality-10, Color Model-Grayscale, Format-Baseline Optimized, Resolution-300 dpi, Ant-Alias-yes

  3. Folder Name: SM (layers A & B hidden and exported as high res RGB jpeg at 300 dpi)
    The files are then run with an action in photoshop and made into GIFS.
    *I found exporting certain files at 72 dpi reduces the required size by 1 pixel in width and/or height. Exact sizes is a must so the solution I found is exporting the files at 300 dpi and resizing them in Photoshop leaves the required specs.
    Specs: Preset-Unnamed, GIF, Selective, No Dither, Lossy-0, Colors-48, Dither-0, Transparency-No, Interlaced-No, Matte-None, Web Snap-0%
    (The jpegs can be deleted once the GIFS are created)

  4. Folder Name: LG (layers A & B hidden, “select all” artwork shown and scaled 140% and exported as high res RGB jpeg at 300 dpi)
    Specs: Preset-Unnamed, GIF, Selective, No Dither, Lossy-0, Colors-48, Dither-0, Transparency-No, Interlaced-No, Matte-None, Web Snap-0%
    (The jpegs can be deleted once the GIFS are created)

So the final folder will contain 5 folders with their different files:
a. ORIGINAL
b. EPS
c. BW
d. SM
e. LG

I am sure there is a much easier way to do this than what I am doing now. But for now this works. Any ideas, please let me know…

Thanks again everyone for your input!

Ryo14, the script can be easily modified to do what you require. As for the exact sizes this is done in the same way by having photoshop rasterize the file larger than required then down sample to specific pixel dimensions, this will be spot on. For most of my processing I use a ratio of at least 2:1 to do this. Got a busy day today but will come back to this. The bulk of it is done should not be too much work from here on in.

Ryo14, steps 3 & 4. Why scale to 140% and export at 300dpi when you could rasterize in photoshop at 420dpi? for the LG then down sample to the SM. No need for the JPEG this step. What are your exact sizes for these in pixels H&W?

Hey Mark67 to be honest with you the process I have been using is what I was used to doing for a long time. Part of the reason I joined this forum is to find different solutions to the processes I use at work. So far so good I must say! The sizes for the various files are all different. So if skipping that part works, I’m all for it. I guess I’ll have to try a handful of files and compare…

Thanks!

Mark67,
Some of the file sizes for the SM are:
80x80
140x140
320x260

Ryo14, are all your files calculated off “Layer D: Canvas layer to output files at specified sizes” so that this can be used in the math for the resizing from the LG version to the SM version? This should be a bit closer to what you wanted a few mor options in it now.

set inputFolder to choose folder with prompt "Where is folder 1."
tell application "Finder"
	set filesListA to files in inputFolder
	set MyFolderA to make new folder at inputFolder with properties ¬
		{name:"EPS"}
	set MyFolderB to make new folder at inputFolder with properties ¬
		{name:"EPS-BW"}
	set MyFolderC to make new folder at inputFolder with properties ¬
		{name:"BW"}
	set MyFolderD to make new folder at inputFolder with properties ¬
		{name:"LG"}
	set MyFolderE to make new folder at inputFolder with properties ¬
		{name:"SM"}
	set MyFolderF to make new folder at inputFolder with properties ¬
		{name:"Originals"}
end tell
repeat with aFile in filesListA
	set fileIndex to 0
	tell application "Finder"
		set theFile to aFile as alias
	end tell
	tell application "Illustrator CS"
		activate
		open theFile with options {update legacy text:true} without dialogs --You may want to set to {update legacy text:false}
		set docRef to the current document
		tell the current document
			delete layer named "layer A" of docRef -- NO questions asked.
			delete layer named "layer B" of docRef -- NO questions asked.	
			do script "Delete Unused Palette Items" from "Default Actions" without dialogs
			do script "Delete Unused Palette Items" from "Default Actions" without dialogs
			set docName to name of docRef
			set docBaseName to getBaseName(docName) of me
			set newFileName to (MyFolderA as string) & docBaseName & "_Colour" & ".eps"
		end tell
		save docRef in file newFileName as eps with options ¬
			{class:EPS save options, compatibility:Illustrator 9, preview:color Macintosh, overprint:discard, embed all fonts:true, embed linked files:true, include document thumbnails:true, compatible gradient printing:false, CMYK PostScript:true, PostScript:level 2}
		close current document without saving
	end tell
end repeat
repeat with aFile in filesListA
	set fileIndex to 0
	tell application "Finder"
		set theFile to aFile as alias
	end tell
	tell application "Illustrator CS"
		activate
		open theFile with options {update legacy text:true} without dialogs --You may want to set to {update legacy text:false}
		set docRef to the current document
		tell the current document
			delete layer named "layer A" of docRef -- NO questions asked.
			delete layer named "layer C" of docRef -- NO questions asked.
			do script "Delete Unused Palette Items" from "Default Actions" without dialogs
			do script "Delete Unused Palette Items" from "Default Actions" without dialogs
			set docName to name of docRef
			set docBaseName to getBaseName(docName) of me
			set newFileName to (MyFolderB as string) & docBaseName & "_Mono" & ".eps"
		end tell
		save docRef in file newFileName as eps with options ¬
			{class:EPS save options, compatibility:Illustrator 9, preview:BW TIFF, overprint:discard, embed all fonts:true, embed linked files:true, include document thumbnails:true, compatible gradient printing:false, CMYK PostScript:true, PostScript:level 2}
		close current document without saving
	end tell
end repeat
tell application "Finder"
	set filesListB to files in MyFolderB
end tell
tell application "Adobe Photoshop CS"
	set display dialogs to never
	close every document saving no
end tell
repeat with aFile in filesListB
	set fileIndex to 0
	tell application "Finder"
		set theFile to aFile as alias
	end tell
	tell application "Adobe Photoshop CS"
		set ruler units of settings to pixel units
		set background color to {class:RGB color, red:255, green:255, blue:255}
		open theFile as EPS with options ¬
			{class:EPS open options, mode:grayscale, resolution:300, use antialias:true, constrain proportions:true}
		set docRef to the current document
		tell docRef
			set docName to name of docRef
			set docBaseName to getBaseName(docName) of me
			set newFileName to (MyFolderC as string) & docBaseName
		end tell
		save docRef in file newFileName as JPEG with options ¬
			{embed color profile:false, format options:optimized, quality:10} appending lowercase extension with copying
		close current document without saving
	end tell
end repeat
tell application "Finder"
	set filesListC to files in MyFolderA
end tell
tell application "Adobe Photoshop CS"
	set display dialogs to never
	close every document saving no
end tell
repeat with aFile in filesListC
	set fileIndex to 0
	tell application "Finder"
		set theFile to aFile as alias
	end tell
	tell application "Adobe Photoshop CS"
		open theFile as EPS with options ¬
			{class:EPS open options, mode:RGB, resolution:420, use antialias:true, constrain proportions:true}
		set docRef to the current document
		tell docRef
			flatten
			resize image resolution 300 resample method none
			set docName to name of docRef
			set docBaseName to getBaseName(docName) of me
			set newFileName to (MyFolderD as string) & docBaseName & "_LG"
		end tell
		save docRef in file newFileName as CompuServe GIF with options ¬
			{colors in palette:48, dither:none, forced colors:web, matte:none, palette:local selective, preserve exact colors:false, transparency:false} appending lowercase extension with copying
		tell docRef
			set docHeight to height of docRef -- To calculate your resize off
			set docWidth to width of docRef -- To calculate your resize off
			resize image height 400 resolution 72 resample method bicubic sharper -- This will be to your choice
		end tell
		set newFileName to (MyFolderE as string) & docBaseName & "_SM"
		save docRef in file newFileName as CompuServe GIF with options ¬
			{colors in palette:48, dither:none, forced colors:web, matte:none, palette:local selective, preserve exact colors:false, transparency:false} appending lowercase extension with copying
		close current document without saving
	end tell
end repeat
tell application "Finder"
	move files in inputFolder to MyFolderF
	move files in MyFolderB to MyFolderA
	delete MyFolderB
end tell

-- Returns the document name without extension (if present)
on getBaseName(fName)
	set baseName to fName
	repeat with idx from 1 to (length of fName)
		if (item idx of fName = ".") then
			set baseName to (items 1 thru (idx - 1) of fName) as string
			exit repeat
		end if
	end repeat
	return baseName
end getBaseName

Hey Mark67 yes that is correct, Layer D is used for the sizing of the files during output…

Thanks! I can’t wait to give that a try!

Hey Mark67 can the exported EPS files have layers A & C hidden instead of deleted? Or is that not scriptable?

Just curious… thanks

In each of the 2 illustrator loops 1 for colour EPS & 1 for BW you need to change 2 lines of snytax:
remove the lines for both:

delete layer named "layer A" of docRef -- NO questions asked.

and replace with:

set properties of layer named "layer A" of docRef to {visible:false}

the same goes for layers “layer B” & “layer C” in each instance.

Hey Mark67 thank you so much for your help. That script is great, I am going to tweak a few things. I’ll let you know how it goes. Sorry I don’t get back sooner, just a bit busy right now…

Hey Mark67 I am trying to make a script (not very successful) that exports Illustrator 10 files as high res CMYK jpegs.
What I want the script do is:

  1. Ask user where folder “1” is. (This will contain the .eps the script will use to make the jpegs)
  2. Open files, then delete “layer A” and then export JPEGS to folder “JPG” (located on desktop)
    The JPEG options are: quality: 10, color model: CMYK, baseline optimized: yes, resolution: 300, Anti-alias: true

*This is how I have been creating my files using an Illustrator action, the drawback is I keep getting dialogue boxes for deleting the layer and jpeg saving options. Also, when the jpegs are saved; I need to resave them in Photoshop with an action to get rid of the generic icon that is generated (I need the icon that shows the actual file preview).

If you could help me out in anyway would be much appreciated. Let me know if there is a much better solution to this then what I have…
Here is what I got, not much : ( I can’t wait until I get the swing of this Applescript thingy…!

choose folder with prompt “Where is folder 1.”
tell application “Finder”
end tell
tell application “Adobe Illustrator 10.0.3”
activate
open theFile with options {«class pCLT»:true} without «class DLOG» --You may want to set to {update legacy text:false}
set docRef to the current document
tell the current document
delete layer named “layer A” of docRef – NO questions asked.
set docName to name of docRef
set docBaseName to getBaseName(docName) of me
end tell
export docRef in file newFileName as jpeg with options ¬
{color model:CMYK, embed color profile:false, format options:optimized, quality:10} appending lowercase extension with copying
close current document without saving
end tell

Ryo14, not all of the options that are available to you in the application are accessible through scripting. Export as JPEG is very limited and not the same as you see in the dialog box. When you have what ever script editing software you are using you should have the option to open the applications dictionary, here you will see the options that are accessible to you.

Hey Mark67 thanks for the info., so the best option to create the jpegs is to rasterize them in photoshop? I’ll give that a try and pick up the code you gave in this posting…

Thanks again

If you need to use Photoshop afterwards any how then this would have been my first choice route for what you need to accomplish. From what little time I have had to read the scripting guide for illustrator the only export option that gives a resolution choice is to Photoshop format all others are 72dpi