Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Sort Vector Art from Bitmaps

Guest
Apr 15, 2008 Apr 15, 2008
Hi,

I have a folder containing over 2000 eps files and need to separate these into raster images and those containing vectors.

The script I am using opens each file in turn and uses the first layer name to determine if the file has been rasterised or not. If not then I update some meta data and close and save the file. If the layer name is "layer 1" I assume the file has vector artwork and has been rasterised, I then close the file without saving changes.

____________ the script__________

var samplesFolder = Folder("J:/Extracted_Standing_Artwork/Non_Customer")
var fileList = samplesFolder.getFiles("*.eps");
for (var i = 0; i < fileList.length; i++) {
if (fileList instanceof File) {
var fileRef = new File(fileList);
app.open( fileRef, );
var layer = app.activeDocument.activeLayer.name;
var filePath = decodeURI(app.activeDocument.path);
var fileName = decodeURI(app.activeDocument.name);
if (layer=="Layer 1"){
app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
}
else{
app.activeDocument.info.author = "Bitmap"
epsSaveOptions = new EPSSaveOptions()
app.activeDocument.close(SaveOptions.SAVECHANGES)
}}}

__________ end ____________

The result is raster files in the folder with a very recent modified date and untouched vector files.

Can anyone please suggest a better way of doing this.
It is possible to test for the "Rasterize Generic EPS Format" dialog box?
Can a javascript then "move" the vector files into a new folder to leave just the rasters in the orginal folder.

Any help would be appreciated.

Simon Kemp
TOPICS
Actions and scripting
685
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Guru ,
Apr 15, 2008 Apr 15, 2008
See if this thread helps http://www.ps-scripts.com/bb/viewtopic.php?t=1113.

It shows how to test for generic eps files

Mike
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Apr 15, 2008 Apr 15, 2008
Thanks for the prompt reply Mike,

I have used you script from the link given but with mixed success.
The script will identify a text file with and with the string "Adobe Photoshop" but does not find the string in an eps that does contain it!

I can see the string if I open the eps in notepad but the script does not see it.

Any ideas?

Simon.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Apr 15, 2008 Apr 15, 2008
If you are able send some sample files to mhale18 at comcast.net and I will take a looks at editing the script.

Mike
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Apr 15, 2008 Apr 15, 2008
Here is a slight change to the function. It works correctly with the sample eps you sent.

function isGenericEPS(file){
var test = file;
test.open('r');
var str = test.read();
test.close();
var res = str.search('Adobe Photoshop');
return res == -1 ? true : false;
};
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Apr 16, 2008 Apr 16, 2008
Mike,

Thanks for the modified script. It did the trick beautifully. Can I ask you one further favour?

Could you explain what each line is doing so I increase my understanding of scripting.

Thanks

Simon Kemp
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Apr 16, 2008 Apr 16, 2008
Line 1 defines the function.

line 2 sets the file object from the argument to the var test. This line is not really needed, I could have just used the file argument. It's likely a hold over from a previous edit.

Line 3 opens the file in read mode.

Line 4 reads the entire file and assigns it to str.

Line 5 closes the file for good housekeeping.

Line 6 search the string in str for 'Adobe Photoshop' and assigns the result to res. res will either be -1 if not found or the start position in the str if it was found.

Line 7 tests the contents of res and either returns true or false. This line could be rewritten as an if statement

if( res == -1){
res = true;
}else{
res = false;
};
return res;

Line 8 closes off the function block.

Hope that helps
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Apr 18, 2008 Apr 18, 2008
Mike,

I don't suppose you would know how to do this in a VB script?

Simon.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Apr 18, 2008 Apr 18, 2008
LATEST
I haven't tested this and my VBS is not that strong but this should be close

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("C:\temp\Text.eps", 1)
str = objFile.ReadAll
objFile.Close
pos = InStr(str,"Adobe Photoshop",1)
' if pos is not 0 the the string was not found
if pos = 0 then
' do whatever you need to to for generic eps
document.write("Generic")
else
document.write("Raster")
end if
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines