Copy link to clipboard
Copied
I have tried for 2 days (off and on) to try to get Bridge CS6 to copy the information from the Description field to the Title field in the metadata. I can get it into the menu, but nothing happens when I modify other scripts. Any suggestions would be greatly appreciated.
If you want a good laugh, I can post my previous attempts.
This is one way to copy the information ...
...#target bridge
if( BridgeTalk.appName == "bridge" ) {
descToTitle = MenuElement.create("command", "Description to Title", "at the end of Tools");
}
descToTitle.onSelect = function () {
if (ExternalObject.AdobeXMPScript == undefined) ExternalObject.AdobeXMPScript = new ExternalObject("lib:AdobeXMPScript");
var thumb = app.document.selections;
for(var s in thumb){
if(thumb.hasMetadata){
var selectedFile = thumb.spec;
var myXmpFile = new XMPF
Copy link to clipboard
Copied
This is one way to copy the information ...
#target bridge
if( BridgeTalk.appName == "bridge" ) {
descToTitle = MenuElement.create("command", "Description to Title", "at the end of Tools");
}
descToTitle.onSelect = function () {
if (ExternalObject.AdobeXMPScript == undefined) ExternalObject.AdobeXMPScript = new ExternalObject("lib:AdobeXMPScript");
var thumb = app.document.selections;
for(var s in thumb){
if(thumb.hasMetadata){
var selectedFile = thumb.spec;
var myXmpFile = new XMPFile( selectedFile.fsName, XMPConst.UNKNOWN, XMPConst.OPEN_FOR_UPDATE);
var myXmp = myXmpFile.getXMP();
var Description = getArrayItems(XMPConst.NS_DC, "description");
myXmp.deleteProperty(XMPConst.NS_DC, "title");
myXmp.appendArrayItem(XMPConst.NS_DC, "title", Description, 0, XMPConst.ALIAS_TO_ALT_TEXT);
myXmp.setQualifier(XMPConst.NS_DC, "title[1]", "http://www.w3.org/XML/1998/namespace", "lang", "x-default");
}
function getArrayItems(ns, prop){
var arrItem=[];
try{
var items = myXmp.countArrayItems(ns, prop);
for(var i = 1;i <= items;i++){
arrItem.push(myXmp.getArrayItem(ns, prop, i));
}
return arrItem;
}catch(e){alert(e +" Line: "+ e.line);}
}
if (myXmpFile.canPutXMP(myXmp)) {
myXmpFile.putXMP(myXmp);
myXmpFile.closeFile(XMPConst.CLOSE_UPDATE_SAFELY);
} else {
xmpFile.closeFile();
}
}
}
Copy link to clipboard
Copied
100% What I needed! It worked flawlessly- thank you very much. Now, it will be interesting to compare yours with what I did to see where, exactly, I went wrong.
Copy link to clipboard
Copied
Paul Riggott
I came across this solution and thought it might fit my needs.
This is the first time I have seen Bridge scripting as I usually stay in the Illustrator scripting arena.
Would it be possible to get this code to move a text item in the Sublocation field to the GPS field?
I currently have several thousand photos with GPS information in the Sublocation field that I would like to move to the GPS fields.
Sublocation: 48.286848, -122.986450
GPS
Latitude: 48,17.21N
Longitude: 122,59.187W
The conversion is easy enough given the Sublocation can be broken into the two components, assigned to variables operated on and them moved to the GPS fields.
I can do the math, but am unfamiliar with the code to get the data and put it where I want.
Thanks for any help you can give me...
Copy link to clipboard
Copied
Can you tell me what the process is to save this as a .jsx? I understand which folder it goes into, and I have the code copy/pasted into Script Editor, but that utility doesn't like the copied code and I'm unable to save.
Copy link to clipboard
Copied
Can you post more information? What operating system? Script Editor on the Mac is for AppleScript, not Adobe Extendscript.