This content has been marked as final.
Show 8 replies
-
1. Re: Sort Vector Art from Bitmaps
Michael L Hale Apr 15, 2008 5:35 AM (in response to Skempy)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 -
2. Re: Sort Vector Art from Bitmaps
Skempy Apr 15, 2008 6:33 AM (in response to Skempy)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. -
3. Re: Sort Vector Art from Bitmaps
Michael L Hale Apr 15, 2008 7:20 AM (in response to Skempy)If you are able send some sample files to mhale18 at comcast.net and I will take a looks at editing the script.
Mike -
4. Re: Sort Vector Art from Bitmaps
Michael L Hale Apr 15, 2008 4:01 PM (in response to Skempy)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;
}; -
5. Re: Sort Vector Art from Bitmaps
Skempy Apr 16, 2008 9:08 AM (in response to Skempy)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 -
6. Re: Sort Vector Art from Bitmaps
Michael L Hale Apr 16, 2008 4:04 PM (in response to Skempy)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 -
7. Re: Sort Vector Art from Bitmaps
Skempy Apr 18, 2008 12:27 AM (in response to Skempy)Mike,
I don't suppose you would know how to do this in a VB script?
Simon. -
8. Re: Sort Vector Art from Bitmaps
Michael L Hale Apr 18, 2008 5:10 AM (in response to Skempy)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

