Copy link to clipboard
Copied
Hi,
I want move Raster format EPS (Photoshop created EPS) into separate folder,
and Vector format EPS (Illustrator/Acrobat created EPS) into separate folder.
via Bridge Scripting - File metadata based file movement into targeted folders...
Thanks in Advance.
Very nice to see someone making an effort!
This example will create two folder and move all Photoshop EPS files into one folder and all others to the second folder.
All EPS files in the current folder are targeted.
...#target bridge
if( BridgeTalk.appName == "bridge" ) {
sortEPS = MenuElement.create("command", "Sort EPS Files", "at the end of Tools","eps");
}
sortEPS.onSelect = function () {
//deselect any selected files
app.document.deselectAll();
//select all eps files
var thumbs= app.document.getSelecti
Copy link to clipboard
Copied
I can do this via ExifTool, however I would need to rely on somebody to come up with the Bridge script for me, which is why I like ExifTool so much!
How would the Bridge script tell the difference between a vector EPS and a raster EPS? One possible method could be to base the metadata on the xmp:CreatorTool application such as Acrobat, Photoshop or Illustrator… However this would generate three different target folders, I am not sure if there is a single/common/shared metadata tag that could be used to only separate Photoshop EPS from Acrobat/Illustrator, some other logic or processing may be needed to clean this up based on different source tag values that may not be common.
Copy link to clipboard
Copied
Here is some findings:
var thumbs = app.document.selections;
for(var a =0;a<thumbs.length;a++){
if(thumbs.type != "file") continue;
var t = new Thumbnail(thumbs.spec);
var md = t.synchronousMetadata;
var Line ='';
Line = decodeURI(thumbs.name);
var creatorTool = md.read("http://ns.adobe.com/xap/1.0/","xmp:CreatorTool");
var displayPath = t.core.immediate.displayPath;
//var fileFormat = t.core.itemContent.fileFormat;
//var xResolution = t.core.quickMetadata.xResolution;
//var yResolution = t.core.quickMetadata.yResolution;
//var fileName = decodeURI(thumbs.name);
alert("File Location: "+displayPath + "\n" +"Creator Tool Name: "+creatorTool);
}
How should i move files based on CreatorTool?
Copy link to clipboard
Copied
Sorry, I can’t help there as I can’t script, which is why I use ExifTool. A single command line entry in ExifTool can often achieve what I am after, easier and faster than hoping that somebody will take pity on me and help with a script. That being said, sometimes I have to hope that somebody takes pity on me at the ExifTool forum and helps beyond the basics, however the community over there is really helpful so this is usually not a big deal. There are some knowledgeable contributors here, so with luck somebody can help with your Bridge script.
Copy link to clipboard
Copied
Very nice to see someone making an effort!
This example will create two folder and move all Photoshop EPS files into one folder and all others to the second folder.
All EPS files in the current folder are targeted.
#target bridge
if( BridgeTalk.appName == "bridge" ) {
sortEPS = MenuElement.create("command", "Sort EPS Files", "at the end of Tools","eps");
}
sortEPS.onSelect = function () {
//deselect any selected files
app.document.deselectAll();
//select all eps files
var thumbs= app.document.getSelection("eps");
if(!thumbs.length) return; //No eps files
if (ExternalObject.AdobeXMPScript == undefined) ExternalObject.AdobeXMPScript = new ExternalObject("lib:AdobeXMPScript");
//create two folders to seperate eps files
var nonPSeps = new Folder(app.document.presentationPath+ '/Non Photoshop EPS');
if(!nonPSeps.exists) nonPSeps.create();
var PSeps = new Folder(app.document.presentationPath+ '/Photoshop EPS');
if(!PSeps.exists) PSeps.create();
//Iterate through all eps files
for(var a in thumbs){
//get metadata in read mode
var xmpf = new XMPFile(thumbs.spec.fsName, XMPConst.UNKNOWN, XMPConst.OPEN_FOR_READ);
var xmp = xmpf.getXMP();
//Check if "CreatorTool" field has data
if( xmp.doesPropertyExist(XMPConst.NS_XMP, "CreatorTool" ) ) {
//get CreatorTool information
var CreatorTool = xmp.getProperty(XMPConst.NS_XMP, "CreatorTool" ).toString();
if(CreatorTool.match("Photoshop")) {
//Photoshop eps file
thumbs.moveTo(PSeps);
}else{
//Non Photoshop eps file
thumbs.moveTo(nonPSeps);
}
}else{
//no xmp move to non Photoshop
thumbs.moveTo(nonPSeps);
}
}//end thumbs
};
Copy link to clipboard
Copied
Excellent work SuperMerlin! And a nice reminder that trying to help oneself may result in others offering more help than simply asking for help without trying! :]
Just curious, would you have chosen the XMP:CreatorTool too without my prior suggestion, or would you have used different metadata as a hook?
For the record, here is the ExifTool code, which would result in three folders titled Adobe Illustrator, Adobe Acrobat, Adobe Photoshop:
exiftool '-directory<${directory}/${PostScript:Creator;s#^(\S+\s\w+).*#$1#g}' '/Users/currentuser/Desktop/Input Directory' -ext .eps -r
This command will recursively scan all subfolders for EPS files within the top level parent “Input Directory” folder of the current logged in user. This command line code is from the Mac OS, on Windows OS simply change the single straight quote/foot mark ' to straight double quote/inch marks " with the correct platform specific path to the top level folder. Although ExifTool can use if/else logic, I have not yet worked out how to create only two folders so the result would be three if there were three different source programs that created the EPS files.
Copy link to clipboard
Copied
Hi Stephen, I always check the rawdata (File Info) to see what are the best fields to use.
I don't use eps files myself so I created a few in Photoshop and download a few others.
PS_Write.F, (ImageMagick), ps_write.f90, Adobe Illustrator CC (Windows)
ExifTool is still the Industry standard and is the best tool if you cant script yourself.
It's great that you are showing the ExifTool examples, it will help many people!
Copy link to clipboard
Copied
Thank your for replay and code...
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more