Script for copying keywords to description field

Does anyone have a script that can be used in cs5 to copy the keywords to the description field?
Thanks
Mark

This should do it...
#target bridge  
if( BridgeTalk.appName == "bridge" ) { 
keysToDesc = MenuElement.create("command", "Keywords To Description", "at the end of Tools");
keysToDesc.onSelect = function () {
   keysToDesc();
function keysToDesc(){
    function getArrayItems(ns, prop){
var arrItem=[];
var items = myXmp.countArrayItems(ns, prop);
   for(var i = 1;i <= items;i++){
     arrItem.push(myXmp.getArrayItem(ns, prop, i));
return arrItem.toString();
if (ExternalObject.AdobeXMPScript == undefined) ExternalObject.AdobeXMPScript = new ExternalObject("lib:AdobeXMPScript");
var thumb = app.document.selections;
    for(var s in thumb){
if(thumb[s].hasMetadata){
        var selectedFile = thumb[s].spec;
  var myXmpFile = new XMPFile( selectedFile.fsName, XMPConst.UNKNOWN, XMPConst.OPEN_FOR_UPDATE);
  var myXmp = myXmpFile.getXMP();
        var Keywords = getArrayItems(XMPConst.NS_DC,'subject').replace(/,/g,';')
         myXmp.deleteProperty(XMPConst.NS_DC, "description");
        myXmp.setLocalizedText( XMPConst.NS_DC, "description", null, "x-default", Keywords );
        if (myXmpFile.canPutXMP(myXmp)) {
        myXmpFile.putXMP(myXmp);
        myXmpFile.closeFile(XMPConst.CLOSE_UPDATE_SAFELY);
         } else {
  xmpFile.closeFile();

Similar Messages

  • Copy keywords into description-field

    Hello,
    I have to work on many pictures so i don't want to do every step for every picture. I have no experience with scription so i ask you.
    I'm searching for a script (or somthing else) that copies the keywords of one file into the description-field of the same file automaticly.
    Yours Robin from Germany

    I have just done a quick test and this seems to work.<br />Copies the keywords to the description field.<br />Make sure that you do a test first!<br />NB:Folder.userData Adobe/XMP/Metadata Templates, folder must exist.<br />Paul<br /><br />#target bridge<br />var items = app.document.selections; <br />      for (var i = 0; i < items.length; ++i) { <br />         var item = items[i];       <br />var m = item.synchronousMetadata; <br />m.namespace = "http://ns.adobe.com/photoshop/1.0/"; <br />var Des = m.read("http://purl.org/dc/elements/1.1/","dc:description");<br />var Keywords = m.Keywords;<br />if(Des.length >0) {<br />     var Description = Des + ";"+Keywords;<br />     }else{<br />               var Description = Keywords;<br />          }<br />          KeywordsToDesc(m, Description);<br />      }; <br /><br />function KeywordsToDesc(metadata, Description) <br />{ <br />var strTmpl = "TempTmpl"; <br />var strUser = Folder.userData.absoluteURI; <br />var filTmpl = new File(strUser + "/Adobe/XMP/Metadata Templates/" + strTmpl + ".xmp");  <br />var fResult = false; <br />try <br />{ if (filTmpl.exists) <br />filTmpl.remove(); <br />fResult = filTmpl.open("w"); <br />if (fResult) <br />// CS3<br />{ filTmpl.writeln("<x:xmpmeta xmlns:x=\"adobe:ns:meta/\" x:xmptk=\"Adobe XMP Core 4.1-c036 46.276720, Mon Feb 19 2007 22:40:08        \">");<br />//CS2<br />//{ filTmpl.writeln("<x:xmpmeta xmlns:x=\"adobe:ns:meta/\" x:xmptk=\"3.1.2-113\">"); <br />filTmpl.writeln(" <rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">"); <br />filTmpl.writeln(" <rdf:Description rdf:about=\"\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\">"); <br />filTmpl.writeln("<dc:description>");<br />filTmpl.writeln("<rdf:Alt>");<br />filTmpl.writeln("<rdf:li xml:lang=\"x-default\">"+Description+"</rdf:li>");<br />filTmpl.writeln("</rdf:Alt>");<br />filTmpl.writeln("</dc:description>");<br />filTmpl.writeln(" </rdf:Description>"); <br />filTmpl.writeln(" </rdf:RDF>"); <br />filTmpl.writeln("</x:xmpmeta>"); <br />fResult = filTmpl.close(); <br />metadata.applyMetadataTemplate(strTmpl, "replace"); <br />filTmpl.remove(); <br />} } <br />catch(e) <br />{ fResult = false; } <br />return fResult; <br />};

  • Keyword and description fields missing when add bookmark

    vers 37.0.1
    In a recent upgrade I notice the keyword and description fields are missing when "bookmark this page".
    When view bookmark properties in bookmarks sidebar these fields appear

    You can make the fields visible with code in userChrome.css ()they have visibility:collapse).
    Add code to the <b>userChrome.css</b> file below the default @namespace line.
    *http://kb.mozillazine.org/userChrome.css
    <pre><nowiki>@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); /* only needed once */
    #editBMPanel_keywordRow,
    #editBMPanel_descriptionRow,
    #editBMPanel_loadInSidebarCheckbox {
    visibility:visible !important;
    </nowiki></pre>
    The customization files userChrome.css (user interface) and userContent.css (websites) are located in the <b>chrome</b> folder in the Firefox profile folder.
    *http://kb.mozillazine.org/Editing_configuration
    You can use this button to go to the currently used Firefox profile folder:
    *Help > Troubleshooting Information > Profile Directory: Show Folder (Linux: Open Directory; Mac: Show in Finder)
    *http://kb.mozillazine.org/Profile_folder_-_Firefox
    *Create the chrome folder (lowercase) in the <xxxxxxxx>.default profile folder if this folder doesn't exist
    *Use a plain text editor like Notepad to create a (new) userChrome.css file in the chrome folder (file name is case sensitive)
    *Paste the code in the userChrome.css file in the editor window
    *Make sure that the userChrome.css file starts with the default @namespace line
    *Make sure that you select "All files" and not "Text files" when you save the file via "Save file as" in the text editor as userChrome.css.<br>Otherwise Windows may add a hidden .txt file extension and you end up with a not working userChrome.css.txt file

  • MAXL Script for copying outline

    Can we write any MAXL Script for copying outline from one aplication/datbase to another application/database.
    Example copying olt from app1.dbb1 to app2.dbb2

    No and yes.
    There is no MaxL statement for copying an outline from one DB to another (Unless you are converting from BSO to ASO). But you can shell system commands like xcopy within a MaxL script (of course you could just do this in your batch or shell script) . Just make sure you stop the Dbs before doing the copy

  • Copy keywords into title field, keep in keywords field

    I have this script that works in cs5, but it is not working in CS6- I am going to try to modify it to copy the keywords into the title field, but also drop the ";" and replace with a ","
    First, I can't get CS6 to run this code, though. Where is it wrong? Thank you for any suggestions-
    #target bridge  
    if( BridgeTalk.appName == "bridge" ) { 
    keysToDesc = MenuElement.create("command", "Keywords To Description", "at the end of Tools");
    keysToDesc.onSelect = function () {
       keysToDesc();
    function keysToDesc(){
        function getArrayItems(ns, prop){
    var arrItem=[];
    var items = myXmp.countArrayItems(ns, prop);
       for(var i = 1;i <= items;i++){
         arrItem.push(myXmp.getArrayItem(ns, prop, i));
    return arrItem.toString();
    if (ExternalObject.AdobeXMPScript == undefined) ExternalObject.AdobeXMPScript = new ExternalObject("lib:AdobeXMPScript");
    var thumb = app.document.selections;
        for(var s in thumb){
    if(thumb[s].hasMetadata){
            var selectedFile = thumb[s].spec;
      var myXmpFile = new XMPFile( selectedFile.fsName, XMPConst.UNKNOWN, XMPConst.OPEN_FOR_UPDATE);
      var myXmp = myXmpFile.getXMP();
            var Keywords = getArrayItems(XMPConst.NS_DC,'subject').replace(/,/g,';')
             myXmp.deleteProperty(XMPConst.NS_DC, "description");
            myXmp.setLocalizedText( XMPConst.NS_DC, "description", null, "x-default", Keywords );
            if (myXmpFile.canPutXMP(myXmp)) {
            myXmpFile.putXMP(myXmp);
            myXmpFile.closeFile(XMPConst.CLOSE_UPDATE_SAFELY);
             } else {
      xmpFile.closeFile();

    There was no need to make a change as it extracts an array and this is converted to a string so that puts the commas inbetween.
    A simple replace can add a space ....
    #target bridge  
    if( BridgeTalk.appName == "bridge" ) { 
    keysToTitle = MenuElement.create("command", "Keywords To Title", "at the end of Tools");
    keysToTitle.onSelect = function () {
    var sels = app.document.selections;
    for(var a in sels){
    md =sels[a].synchronousMetadata;
    md.namespace = "http://ns.adobe.com/photoshop/1.0/";
    var Keys =  md.Keywords.toString().replace(/,/g,', ');// Replace a comma with comma space
    md.namespace = "http://purl.org/dc/elements/1.1/";
    md.title ='';
    md.title = Keys;

  • Custom Calculation Script to copy value of a field

    Hi,
          I'm trying to copy the value of a field into another field and display it in the pdf. This is for the 1099's. We are trying to print 2 copies(Copy B and Copy 2) in one page. The first field will come from the XML file. I need to copy the value of this field into the second field. Can anyone please help me with the calculation script for this. I tried the getField.value and it didn't work in the pdf. Thanks.
    With Regards,
    Satishpdf.

    Hi,
    There are a couple of approaches.
    One would be to put the script in the radio buttons that when clicked would do the calculate and set the value of the numeric field.
    Another would be to have the script in the calculate event of the numeric field looking back at the value of the radio button. Taking this approach the script in the numeric field calculate event would look like this:
    if (radioButton.rawValue == 1) // radio button bound to 1 is on/yes
         this.rawValue = ; // your calculation goes here
    else
         this.rawValue = null;
    This is testing the value of the radio button and then taking appropriate calculations.
    Hope that helps,
    Niall

  • Need Help with script For Bulk Users Name & Description Updation

    Hi Guys,
    I have below requirement :
    We are having one windows 2008 stand alone server with 200+ local users (No Active Directory Account).
    1. Requirement is to update each account's "Full name" and "Description field" with same text. Which means , Full name and Description field will be same with same text. No other changes are required. )Attached the screenshot)
    Can you guys pls help me out with any scripting (vbs , powershell , DOS .etc etc) method to accomplish this task quickly as manual process is very troublesome and take long time.
    Any help will be highly appreciated,
    Thanks,
    Suvajit Basu

    Hi,
    I dont have any script but seeking for a help.
    Thanks,
    Suvajit Basu
    In that case you should read this first:
    https://social.technet.microsoft.com/Forums/scriptcenter/en-US/a0def745-4831-4de0-a040-63b63e7be7ae/posting-guidelines?forum=ITCG
    Prewritten scripts can be found in the repository (Brent has already suggested one for you):
    https://gallery.technet.microsoft.com/scriptcenter
    If you can't find what you need and you can't write your own, you can request a script here:
    https://gallery.technet.microsoft.com/scriptcenter/site/requests
    Let us know if you have any specific questions.
    Don't retire TechNet! -
    (Don't give up yet - 13,085+ strong and growing)

  • Logon Scripts for copying files in Windows 7

    Issues using Logon scripts to copy files in windows 7.  Its default is to append the file rather than copy and replace, which is what XP did.  How can I achieve the same results using
    logon scripts in W7 to copy any files to specified folders and replacing old files.  The reason for this is that we use a software that performs offsite/onsite updates and the only way all the users can have the correct version/tables is to either manually
    update each user in a 90+ user environment or use a logon script to perform the coping of the updates.  Unfortunately the software support won’t create a (while logging in to software) patch for this.  So we have to force it during the user logon.

    Hi Novice,
    It should depend on your script content. it's recommended you ask in the official scripting guys forum for professional help:
    https://social.technet.microsoft.com/Forums/scriptcenter/en-US/home?forum=ITCG
    Karen Hu
    TechNet Community Support

  • Script for copying or moving files from windows server to another remote windows server

    Copy below 2 line into notepad and save as movescript.vbs
    execute in command prompt
    c:\cscript movescript.vbs  (Press ENTER)
    Files will move to remote location.
    =========================================
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    objFSO.MoveFile "C:\scripts\*.txt","\\servername\c$\share"
    =========================================
    for copy files to remote location
    =========================================
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    objFSO.CopyFile "C:\scripts\*.txt","\\servername\c$\share"
    =========================================
    Lets us know if you face any error. reply back to me on [email protected]
    Thank you.....
    Regards Ravikiran MCITP

    What is your question?  Are you asking how to do this?  Can you post the errors?
    ¯\_(ツ)_/¯

  • Script for copying contracts

    Looking a script to copy contacts from outlook 2010 to office 365. Thanks
    This topic first appeared in the Spiceworks Community

    Looking a script to copy contacts from outlook 2010 to office 365. Thanks
    This topic first appeared in the Spiceworks Community

  • A script for copying certain files to a new location

    I have a folder with over 50,000 images in it. I need about 15,000 of them copied to another folder.
    Is there a script (that I can paste the list of the ones I need copied) to perform this action?
    Thanks in advance.

    perhof,
    After much googling, I was fortunate enough to find your beautiful script!
    I added a couple of things like subfolder recusion ( by tweaking scripts I found) .
    Would you be kind enough to look this over and see if it's ok or needs fixing?
    Thanks for any help,
    ec
    [code]
    ' Read a list of images from text file
    ' and copy those images from SourceFolder\SubFolders to TargetFolder
    ' Should files be overwriten if they already exist? TRUE or FALSE.
    Const blnOverwrite = TRUE
    Dim objFSO, objShell, WSHshell, objFolder, objFolderItem, strExt, strSubFolder
    Dim objFileList, strFileToCopy, strSourceFilePath, strTargetFilePath
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objShell = CreateObject("Shell.Application")
    Set WSHshell = CreateObject("WScript.Shell")
    Const ForReading = 1
    ' Make the script useable on anyone's desktop without typing in the path
    DeskTop = WSHShell.SpecialFolders("Desktop")
    strFileList = DeskTop & "\" & "images.txt"
    ' File Extension type
    strExt = InputBox("Please enter the File type" _
    & vbcrlf & "For Example: jpg or tif")
    If strExt="" Then
       WScript.Echo "Invalid Input, Script Canceled"
    Wscript.Quit
    End if
    ' Get the source path for the copy operation.
    Dim strSourceFolder
    Set objFolder = objShell.BrowseForFolder(0, "Select source folder", 0 )
    If objFolder Is Nothing Then Wscript.Quit
    Set objFolderItem = objFolder.Self
    strSourceFolder = objFolderItem.Path
    ' Get the target path for the copy operation.
    Dim strTargetFolder
    Set objFolder = objShell.BrowseForFolder(0, "Select target folder", 0 )
    If objFolder Is Nothing Then Wscript.Quit
    Set objFolderItem = objFolder.Self
    strTargetFolder = objFolderItem.Path
    Set objFileList = objFSO.OpenTextFile(strFileList, ForReading, False)
    On Error Resume Next
    Do Until objFileList.AtEndOfStream
        ' Read next line from file list and build filepaths
        strFileToCopy = objFileList.Readline & "." & strExt
        ' Check for files in SubFolders
        For Each strSubFolder in EnumFolder(strSourceFolder)
          For Each strFileToCopy in oFSO.GetFolder(strSubFolder).Files
        strSourceFilePath = objFSO.BuildPath(strSubFolder, strFileToCopy)
        strTargetFilePath = objFSO.BuildPath(strTargetFolder, strFileToCopy)
        ' Copy file to specified target folder.
        Err.Clear
        objFSO.CopyFile strSourceFilePath, strTargetFilePath, blnOverwrite
        If Err.Number = 0 Then
            ' File copied successfully
            iSuccess = iSuccess + 1
            If Instr(1, Wscript.Fullname, "cscript.exe", 1) > 0 Then
                ' Running cscript, output text to screen
                Wscript.Echo strFileToCopy & " copied successfully"
            End If
        Else
            ' Error copying file
            iFailure = iFailure + 1
            TextOut "Error " & Err.Number & _
            " (" & Err.Description & ")trying to copy " & strFileToCopy
        End If
       Next
    Next
    Loop
    strResults = strResults + 0 '& vbCrLf
    strResults = strResults & iSuccess & " files copied successfully." & vbCrLf
    strResults = strResults & iFailure & " files generated errors" & vbCrLf
    Wscript.Echo strResults
    Sub TextOut(strText)
        If Instr(1, Wscript.Fullname, "cscript.exe", 1) > 0 Then
            ' Running cscript, use direct output
            Wscript.Echo strText
        Else
            strResults = strResults & strText & vbCrLf
        End If
    End Sub
    Function EnumFolder(ByRef vFolder)
    Dim oFSO, oFolder, sFldr, oFldr
    Set oFSO = CreateObject("Scripting.FileSystemObject")
    If Not IsArray(vFolder) Then
    If Not oFSO.FolderExists(vFolder) Then Exit Function
    sFldr = vFolder
    ReDim vFolder(0)
    vFolder(0) = oFSO.GetFolder(sFldr).Path
    Else sFldr = vFolder(UBound(vFolder))
    End If
    Set oFolder = oFSO.GetFolder(sFldr)
    For Each oFldr in oFolder.Subfolders
    ReDim Preserve vFolder(UBound(vFolder) + 1)
    vFolder(UBound(vFolder)) = oFldr.Path
    EnumFolder vFolder
    Next
    EnumFolder = vFolder
    End Function
    [/code]

  • A script for copying smilar files to a new location

    Hi,
    i newbies to scripting. My challenge is that I want a script to only copy files with names "similar" and not "exactly the same" as the filenames in the text file.
    For example some files have 10 letters file name like "ABC01FGH01.tif".  I have to copy file where starting letter "ABC" and middle letter "FGH" of file name are fixed, but other letters are changed.
    The script sees a file name like "ABC**FGH**.tif", it should search the source location and copy the files having filenames with at least this characters e.g. "ABC02FGH02.tif", "ABC03FGH04.tif" should be copied since it has
    contains "ABC**FGH**.tif".
    Please help.

    Learn how to use wildcards in file names.  '*' is for any number of characters and'?' is for one character.
    COPY ABC??DE???.?x? c:\target
    Start by using DIR
    DIR ABC??DEF???JK.?x?
    ¯\_(ツ)_/¯

  • Script for copying files to drop boxes of other Macs

    I don't know much about scripts as yet, but for daily backup purposes
    I would like to copy all new or modified files from various folders
    to the drop boxes of two other Macs (like the old DOS command XCopy)
    and then reset the "modified attributes" (is there something like that at all?)
    of these files.
    A script could do this without the need to always find and select these files
    and to always confirm the messages "You can put items into “Drop Box”,
    but you won’t be able to see them. Do you want to continue?".
    Thanks!

    Here is a short skeleton which doesn't treat subfolders.
    May you check if it do what you want ?
    property sourceFolder : "/Users/home/Documents/Pages/current/"
    property destFolder : "/cr1’s iMac.afpovertcp.tcp.local/cr1's%20Public%20Folder/Drop Box/backup/Documents/Pages/current/"
    on run
    tell application "System Events"
    set dest_folder to path of folder destFolder
    set listeSource to path of disk items of folder sourceFolder
    repeat with sf in listeSource
    if visible of disk item sf then
    tell disk item sf
    set sn to name
    set smd to modification date
    end tell
    if exists disk item sn of folder destFolder then
    set needCopy to modification date of disk item sn of folder destFolder is not smd
    else
    make new file at end of folder destFolder with properties {name:sn}
    set needCopy to true
    end if -- exists disk item
    if needCopy then my copyFile(sf, dest_folder)
    end if -- visible …
    end repeat
    end tell -- System Events
    end run
    on copyFile(sourceFile, targetFolder) (*
    sourceFile is the path to the source file as text,
    dest_folder is the path to the destination folder as text
    newFileName is the name of the file as text
    tell application "Finder"
    duplicate file sourceFile to folder targetFolder with replacing
    end tell
    end copyFile
    Yvan KOENIG (VALLAURIS, France) mercredi 16 décembre 2009 18:33:43

  • NAnt Script for copying msi's

    hi all,
    how are you:)
    i want to copy msi's from more than one shared location to my system's staging folder. i mean some msi's from one shared location and some from other shared location
    but all should be in staging folder created in my system. it is like daily nightly builds will run and a msi's will be placed in the folder. it should pick the msi's from folder created with current date.
    i am need of this, please help me
    Thanks and Regards,
    Tilakraj

    Hello,
    The TechNet Sandbox forum is designed for users to try out the new forums functionality. Please be respectful of others, and do not expect replies to questions asked here.
    As it's off-topic here, I am moving the question to the
    Where is the forum for... forum.
    Karl
    When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answer.
    My Blog: Unlock PowerShell
    My Book: Windows PowerShell 2.0 Bible
    My E-mail: -join ('6F6C646B61726C40686F746D61696C2E636F6D'-split'(?&lt;=\G.{2})'|%{if($_){[char][int]&quot;0x$_&quot;}})

  • Script for copy and compile objects from one schema to another

    Hi,
    I have 2 schemas like schema1 and schema2 in both schemas i have same procedures/function like p_test1 .If i modify a procedure in schema1 i want same modifications in schema2 so i want a script to apply these changes to schema 2.
    except bellow process  any alternative
      SET PAGESIZE 10000
      SET feedback OFF
      SET heading OFF
      SET echo OFF
      spool d:\SQL.OUT
       SELECT TEXT
        FROM USER_SOURCE
        WHERE NAME = 'MY_PROCEDURE';
      spool OFF
      SET echo ON
      SET feedback ON
      SET heading ON
    CONNECT OTHER_USER/OTHER_PASSWORD@OTHER_DATABASE;
    @d:\SQL.OUT

    All what you have to know about that function :
    http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_metada.htm#sthref3536
    Nicolas.

Maybe you are looking for