Script to add keywords in Bridge based on the name of the file

I'm working on a script that adds keywords based on the name of the image file. So, if the name of the file is AG123456 (08_16) .tif, this script would add "Agriculture", "123456" and "8/16" as keywords in bridge. "" I have a small sample of the part that retrieves the name of the file written in AppleScript below of each keyword. I know that I need to write the part that actually adds the keywords in Bridge in JavaScript, because the bridge is not capable of AppleScript. I have trouble finding the JavaScript code, I need to add the keyword. If someone could help me with this, I would really appreciate it.

I would like to call the JavaScript code to in AppleScript instead of writing all the code in JavaScript. (The full version of it's longer, it would be a lot of code to change in JavaScript).

on Open of droppedfiles

with timeout of 900 seconds -> Changing timeout to 15 minutes. Default value is 2 minutes.

  -------------------------------------------------------------

-GET THE CHARACTERS OF THE FILE name

  -------------------------------------------------------------

Repeat with aFile in droppedfiles

say application 'Finder '.

the value file name to name of aFile

end say

  -------------------------------------------------------------

  -------------------------------------------------------------

  -------------------------------------------------------------

-ADDED a KEYWORD FOR EACH PREFIX

  -------------------------------------------------------------

-Find the prefix in the name of the file

if text 1 thru 2 of file name contains "AG" then

the value prefixKeyword to 'Agriculture '.

else if text 1 thru 2 of file name contains "To THE" then

the value prefixKeyword to "Automobile".

on the other

the value prefixKeyword to "Need to prefix".

end if

-Adding the prefix as a keyword

display dialog prefixKeyword string

  -------------------------------------------------------------

  -------------------------------------------------------------

  -------------------------------------------------------------

-ADDED a KEYWORD FOR EACH SKU NUMBER

  -------------------------------------------------------------

-Creating a list of all single digit numbers

the value numberList to {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"}

-Looking FOR THE SKU NUMBER

-Looking for a six-digit number that starts on the third character of the file name

if numberList contains (text 3 of file name) et numberList contains (text 4 of the file name) et numberList contains (text 5 of filename) et numberList contains (text 6 of file name) et numberList contains (text 7 of file name) then

if numberList does not work contain the text 9 of file name and then

if numberList contains (text 8 of the file name) then

the value skuNumber to of 3 to 8 text filename

the value skuNumberOffset to 8

end if

end if

-Searching for a six-digit number that begins on the fourth character of the file name

else if numberList contains (text 4 of the file name) et numberList contains (text 5 of filename) et numberList contains (text 6 of file name) et numberList contains (text 7 of file name) et numberList contains (text 8 of the file name) then

if numberList does not work contain the 10 text of file name and then

if numberList contains (text 9 of file name) then

the value skuNumber to text 4 to 9 of file name

the value skuNumberOffset to 9

end if

end if

-Defining the SKU number to alert keyword keyword the user can search the

on the other

the value skuNumber to "Need SKU number.

set skuNumberOffset to 0

end if

-ADDING THE SKU AS NUMBER one keyword

display dialog skuNumber string

  -------------------------------------------------------------

  -------------------------------------------------------------

  -------------------------------------------------------------

-DATE ADDITION OF FILE name

  -------------------------------------------------------------

if file name contains "(" et nom de fichier contient ")" then "

set leftParen to "("

set rightParen to ")"

-Obtain the month of the file name

set monthOffset of (offset of leftParen in fileName) + 1 -> character returns immediately after)

set fileNameMonth to character of filename monthOffset

-Get all the numbers of the year of the file name

set fileNameYearOffset1 to (offset of leftParen in file name) + 3

set fileNameYearOffset2 to (offset of rightParen in file name)-1

set fileNameYear1 to character of filename fileNameYearOffset1

set fileNameYear2 to character of filename fileNameYearOffset2

set of characters fileNameYear fileNameYearOffset1 to fileNameYearOffset2 of file name

set dateKeyword to fileNameMonth & "/" & fileNameYear

-ADDING THE SKU AS NUMBER one keyword

display dialog dateKeyword string

end if

  -------------------------------------------------------------

  -------------------------------------------------------------

fin Repeat

end timeout

end open

Here's an example of adding of keywords in a file, the code can be used in Bridge or Photoshop.

var Keys = ["keyword1","keyword2","keyword3"];
var file = File (Folder.desktop + "/zz.jpg");
if(file.exists) setKeyword( file,Keys);

function setKeyword( file,Keys){
if ( !ExternalObject.AdobeXMPScript ) ExternalObject.AdobeXMPScript = new ExternalObject('lib:AdobeXMPScript');
        var xmpf = new XMPFile( File(file).fsName, XMPConst.UNKNOWN, XMPConst.OPEN_FOR_UPDATE );
        var xmp = xmpf.getXMP();
        for(var s in Keys){
        xmp.appendArrayItem(XMPConst.NS_DC, "subject", Keys[s], 0,XMPConst.PROP_IS_ARRAY);
    }
      if (xmpf.canPutXMP( xmp )) {
         xmpf.putXMP( xmp );
      }
      xmpf.closeFile( XMPConst.CLOSE_UPDATE_SAFELY );
};

Tags: Bridge

Similar Questions

  • Setup could not initialize - I've lost hours trying to find solutions online and forum... to change the file to add .old - does not work; Open the file 2/2 still didn't work... Help!

    Setup could not initialize - I've lost hours trying to find solutions online and forum... to change the file to add .old - does not work; Open the file 2/2 still didn't work... Help!

    Please see the links below:

    https://forums.Adobe.com/thread/1848277

    https://forums.Adobe.com/thread/2055767

    Let us know, if you still get the same error even after trying it all the steps mentioned

  • Java Script to perform a different Action based on the Orientation of the Image

    I need help creating a Java Script to perform a different action based on image orientation landscape vs. portrait. Can someone help me in this task.

    Thank you

    The Wookiee

    That should do it.

    docRef = app.activeDocument;

    If (docRef.width > docRef.height) doAction ("Action of landscape", "action group '");

    another action ('Portrait Action', 'Action Group');

  • Add a second id and lose the file associations

    On two of the computer after adding a nw user, when you add new programs lose us all file associations.

    Hello

    1. is the issue limited to the new user account?

    Method 1:

    You can run the fix provided in the link below it to solve the problem.

    When you run an .exe on a Windows XP, Windows Vista or Windows 7 computer file, the file can start another program

    http://support.Microsoft.com/kb/950505

    Method 2:

    The question could also be linked to the damaged user account, you can create a new user account and check if the problem persists.

    Reference:

    How to create and configure user accounts in Windows XP

    http://support.Microsoft.com/kb/279783

  • Adobe Bridge by removing the file directly

    Hi, I'm Brazilian.
    I have the following problem when I delete the file in Adobe Bridge, file is deleted directly without asking if I want to delete.
    How to work with files on the server I do sometimes work and torque remove unintentionally and eventually the removal of my own work. without asking if I want to really delete.

    How to solve this problem?

    Maybe at some point you said bridge do not show again when deleting a file?

    If this is the case you can goto Preferences > General > reset all warning dialog boxes.

  • Bridge CC combines the files of version of Illustrator that was never installed on my machine

    I'm running a Windows 10 machine. I have Adobe CS 5.5 Production, Adobe CS6 Design & Web (upgrade) and recently bought Adobe CC. When I built my machine about 6 months ago, I had to install a single application of the suite 5.5 to serve a product calling in order to install the CS6 upgrade. I chose to install hearing CS 5.5. This allowed me to install CS6. Then about 2 months ago I decided to purchase the suite CC (PS, InD, Ai, Dw, Br, DC Acr). I uninstalled hearing 5.5 and CS6, rebooted and then installed the CC applications.

    CC bridge opened and when I right click on any image file (jpg, png, have, ps), the shortcut menu displays an option to "Open with" and another menu extends list Illustrator as well as a default application. If I choose to Illustrator, I receive an error message that says it can't find Illustrator CS 5.5. I don't know why he is referred to this version, because I never even installed it. I searched this directory path in the Windows registry and it goes up to a dozen times.

    Why is-bridge linking "Illustrator" in the context menu with an older version of the app?

    My list of Associations of Illustrator file as a viable application Type, but it is not the right version of CC.

    Short to manually edit the entries of FTA, is there a way to get the bridge to view the current version and stop looking for the CS 5.5 version?

    Here are the screenshots of the error message and the Associations of the Type of file in the Preferences window.

    Bridge Error.jpg

    bridge-file-association.jpg

    Just click on the small triangle to change association

  • Script to change political colors managent or open the files with "keep profile".

    Hello!

    I am trying to open the girls with the parameter 'profile hunt kept '' through my script.

    I really don't like if it's done with "openoptions" or changing policies managent RGB and CMYK color to "preserve the profile. (Available via the Edit menu-> color settings.)

    I know that this is possible through action, but I really need to change that through my script.

    I'm totally at a loss here, so any pointers in the right direction would be much appreciated!

    Thank you!

    / Peter

    A slightly cleaned up version:

    Open the file without warning mismatch and keep current color space:

    2015, use it at your own risk.

    #target photoshop

    Var ref = new ActionReference();

    ref.putProperty (stringIDToTypeID ("property"), stringIDToTypeID ("colorSettings"));

    ref.putEnumerated (charIDToTypeID ("capp"), charIDToTypeID ("Ordn"), charIDToTypeID ("Trgt"));

    var docDesc = executeActionGet (ref);

    var colorSetting = docDesc.getObjectValue (stringIDToTypeID ("colorSettings"));

    var theOpenMismatch = colorSetting.getBoolean (stringIDToTypeID ("askMismatchOpening"));

    var theRGBPolicy = colorSetting.getEnumerationValue (stringIDToTypeID ("policyRGB"));

    var theCMYKPolicy = colorSetting.getEnumerationValue (stringIDToTypeID ("policyCMYK"));

    var theGrayPolicy = colorSetting.getEnumerationValue (stringIDToTypeID ("policyGray"));

    disable the warning;

    preserve var is stringIDToTypeID ('Star');.

    setPolicy (preserve, maintain, preserve, false);

    Open the file;

    App.Open (new File("~/Desktop/VA13AHN_1.psd"));

    back to the setting;

    setPolicy (theRGBPolicy, theCMYKPolicy, theGrayPolicy, theOpenMismatch);

    political game.

    function setPolicy (RGB, CMYK, gray, theBool) {}

    // =======================================================

    var idsetd = charIDToTypeID ("setd");

    var desc16 = new ActionDescriptor();

    var idnull = charIDToTypeID ("null");

    ref4 var = new ActionReference();

    ref4.putProperty (charIDToTypeID ('Rprp"), stringIDToTypeID ("colorSettings'));

    ref4.putEnumerated (charIDToTypeID ("CAPP"), charIDToTypeID ("Ordn"), charIDToTypeID ("Trgt"));

    desc16.putReference (idnull, ref4);

    idT var = charIDToTypeID ("T");

    var desc17 = new ActionDescriptor();

    var idpolicyRGB = stringIDToTypeID ("policyRGB");

    var idpolicy is stringIDToTypeID ('policy');.

    desc17.putEnumerated (idpolicyRGB, idpolicy, RGB);

    var idpolicyCMYK = stringIDToTypeID ("policyCMYK");

    desc17.putEnumerated (idpolicyCMYK, idpolicy, CMYK);

    var idpolicyGray = stringIDToTypeID ("policyGray");

    desc17.putEnumerated (idpolicyCMYK, idpolicy, gray);

    var idaskMismatchOpening = stringIDToTypeID ("askMismatchOpening");

    desc17.putBoolean (idaskMismatchOpening, theBool);

    var idcolorSettings = stringIDToTypeID ("colorSettings");

    desc16.putObject (idT, idcolorSettings, desc17);

    executeAction (idsetd, desc16, DialogModes.NO);

    };

  • With LR 3.4.1 my keywords are not saved to the file

    Since upgrading to LR 3.4.1 my keywords are more saved in files, so I can't see them in an external application. If I go back to LR 3.3 it works OK. Any ideas?

    I have the put option to automatically save changes to XMP.

    I tried to write metadata in the files manually, and that does not work either.

    The files are .jpg

    I use a PC under Windows 7 32 bit.

    Thank you...

    External drives often have special ACL on them which can cause problems for some applications to access. All it takes is for Lr change how it accesses files and file metadata (even a change that make it more "correct" - that is, a bug for another problem fix) and he can discover the problems of ACL.

    I don't know what you would have to do on Windows, but on a Mac, I would make sure that the drive is set up to be "shared" so there additional special ACLs on this subject that allow to take ownership.

    But, you want to start at the root of the drive, and reset the ACL (NOT only "permissions" which are older, simulated and incomplete parameters and making sure that recursion through the entire folder structures) as owner/creator and administrators have full control. There may be some other required special ACL if you want to share this album with different users on different computers. This part, I'm not familiar with, but it is often on Windows support sites. Quick eye or people with similar problems with remote disc for Windows services.

    Remember, if you have a login on two different machines to Windows (assuming you don't have some sort of connection to the network) it is technically two different users (even if they have the same name).

  • Action Script to add a node value parent for the top node

    I need to add a new value of the node parent to a hierarchy to the top node.  The script parameters to add a node is "Add | Version | Hierarchy | Node | Parent Node. Property sheet. "  I am at a loss on what to do for the top node because there is no node Parent above this level, but the settings ask him.  I have reviewed the manual and the manual of admin, but did not help.  Can someone help me?

    Thank you!

    You have the answer with you, do not be confused between the Parent node and the top node context, when adding a new node, the node of your Top will become your Parent node.

    ' Add | Version | Hierarchy | Node | Parent Node. Property of the worksheet.

    If you're still confused, just do the following.

    1. right click on the node of your top and add a new worksheet or node branch manually

    2. Once added, go back to the homepage-> Script

    3. Select the Type of Source in the paper transactions, and then select the newly added node and load

    4. in the lower part select Script-> download-> Download Action Script.

    5. open in a Notepad and use to create your new script.

  • Why are they not my clips keyworded in FCPX added to the files?

    When I add a keyword to a clip, it creates the blue line (and will even create a new folder for the keyword witinin project), however, it does not add the clip in the folder keyword.

    Here's a 60 second video of what is happening: https://youtu.be/jnEgH_1j2hM

    I am new to FCPX, so any help is appreciated.

    Thank you

    Cree

    There is something in the filter box in the upper right corner of the browser.

  • script to save .pdf with different presets generates the file size low resolution wildly different interactive operation

    The script below is adapted in part from that has been with Illustrator and other pieces and the pieces that I picked up the Forum.  When I run it on a 15.3 Mg .ai file it produces

    . The same PFS size that would be the case if I manually created at Headquarters printing and by default; but the low-resolution sort option to 9 Mg as opposed to the 439 K he "should" be.

    Please someone be kind advise me how can I change the script to work as I want that: I had counted on my custom screening done the work for me.  Thank you in advance.

       var jiName=app.activeDocument.name
    
       var pos = jiName.indexOf(".ai"); 
          if (pos > 0){
              jiName=jiName.substr(0,(pos))  
          }
        var pos = jiName.indexOf(".pdf"); 
          if (pos > 0){
             jiName=jiName.substr(0,(pos)) 
          }
        
        var saveProof = new Window ("dialog", "Save Proof");
            saveProof.orientation="column"
            saveProof.alignChildren = "center";
            
      var sPGroup1 = saveProof.add ("group");
            sPGroup1.orientation="column"
            sPGroup1.add ("statictext", undefined, "File Name");
                
      var save_pdf = sPGroup1.add ('edittext {text:"", characters: 30, justify: "center", active: true}');
            save_pdf.text=jiName+".pdf"
            
      var sPdQButtonGroup = saveProof.add ("group");
            sPdQButtonGroup.alignment = "center"; 
            sPdQButtonGroup.alignChildren="row"
            sPdQButtonGroup.add ("statictext", undefined,"File Quality");
      var HQ=sPdQButtonGroup.add ("radiobutton", undefined, "  HI-RES  ");
      var IDefault=sPdQButtonGroup.add ("radiobutton", undefined, "  Standard  ");
      var lowres=sPdQButtonGroup.add ("radiobutton", undefined, "  low-res  ");
            sPdQButtonGroup.children[1].value = false;
            sPdQButtonGroup.children[3].value = false;
            sPdQButtonGroup.children[2].value = true;
            sPdQButtonGroup.active=true;
            sPdQButtonGroup.visible=true;
            
      var sPButtonGroup = saveProof.add ("group");
            sPButtonGroup.alignment = "center"; 
            sPButtonGroup.alignChildren="row"      
                
      var sPok=sPButtonGroup.add ("button", undefined, "Save Proof");
      var sPcancel=sPButtonGroup.add ("button", undefined, "Exit");
            sPButtonGroup.active = true;
               
            sPcancel.onClick = function() {
               //sP_ok=false;
               saveProof.close();
                           }
            sPok.onClick = function() {
                
                  app.executeMenuCommand('save'); // save existing Illustrator file
                  
                  var my_pdf= new File("users/Les/Desktop/PROOFS/"+save_pdf.text); //Full File Path 
                  
                  saveFileToPDF(my_pdf);
                              
                  function saveFileToPDF(myFile){  
                  //Setup Save Options for PDF  
                  var saveOpts = new PDFSaveOptions();  
                  saveOpts.compatibility = PDFCompatibility.ACROBAT6;
                  saveOpts.generateThumbnails = true;  
                  saveOpts.preserveEditability = true;
                  saveOpts.requirePermissionPassword = true;  
                  saveOpts.permissionPassword = "*-*-*-*-*-*";
                  saveOpts.compressArt = true; //default
                 saveOpts.embedICCProfile = true;
                 saveOpts.enablePlainText = true;
                 saveOpts.generateThumbnails = true; // default
                 saveOpts.optimization = true;
                 saveOpts.pageInformation = true;
                  
                  if (HQ.value==true){
                    saveOpts.pDFPreset = '[High Quality Print]';
                  }
              
                  if (IDefault.value==true){
                    saveOpts.pDFPreset = '[Illustrator Default]';
                  }
              
                  if (lowres.value==true){
                    saveOpts.compatibility = PDFCompatibility.ACROBAT4;
                    saveOpts.pDFPreset = 'Smallest File Size v4';
                  }
              
                  //  
                  var originalInteractionLevel = userInteractionLevel;        //save the current user interaction level  
                  app.userInteractionLevel = UserInteractionLevel.DONTDISPLAYALERTS;      //Set user interaction level to suppress alerts  
                  app.activeDocument.saveAs(myFile,saveOpts);        //Save File  
                  userInteractionLevel = originalInteractionLevel;        //Set user interaction level back to original settings 
                                }
                            
                  saveProof.close();
                  
            }
                
      saveProof.active=true
      saveProof.show()
    
      
    
    

    Oh, please check that: ' "saveOpts.preserveEditability = true;".

    Maybe try to disable this option.

  • How can we add a new menu item in the file Menu?

    Hello

    I want to create the menu item on the file Menu, I want to create a new menu item, just after the item "save under...". ». Is this possible with SDK?

    Thanks in advance

    Farida kaid

    You can file a new menuitem in any "menu group" defined by the Illustrator. If you look at AIMenuGroups.h, you will find the names of various groups of menuitems. There are two that might be what you want: kSaveForMenuGroup & kSaveMenuGroup. I can't remember how much control you have within a group, but it would at least allow you to get close enough.

  • Script to add markers to the text in paragraph format

    With previous versions of Framemaker, I had a FrameScript that loop in my document and add a text marker based on the applied paragraph format. The marker text would be the selected paragraph.

    I try now to recreate it in Extendscript for use in Framemaker 10 and am completely perplexed.

    I have no doubt that my script (copied below) is completely off track, but I was wondering if someone would be able to help point me in the direction of my many mistakes.

    Basically I want the script to find all paragraphs with the "* Ref." format applied, make this text range of text and then apply a marker at this beach. A little research showed that I probably need to create a list of paragraph formats, but I think I have a lot more problems than that.

    var pgfFmt1 = flow. GetNamedPgfFmt (* part No.);

    While (pgfFmt1.ObjectValid ())

    {

    function createMarker (doc, FMP, offset, type, text) {}

    var strange, marker;

    Strange = pgfFmt1.TextRange;

    marker = doc. NewAnchoredObject (Constants.FO_Marker, strange);

    marker. MarkerType = type;

    marker. MarkerText = text;

    Return 1;

    }

    createMarker (doc, bmp, 0, 'Index', 0);

    Thank you in advance to anyone who is able to offer me some advice!

    You can use the following function to get the text of a paragraph of FrameMaker.

    function getText (textObj) {}

    var objText = "";

    Get a list of strings of the object.

    var textItems = textObj.GetText (Constants.FTI_String);

    Concatenate the strings.

    for (var i = 0; i)< textitems.len;="" i="" +="1)">

    objText += (textItems [i] .sdata);

    }

    Return objText;

    }

    Once you add it to your script, you can modify each call to createMarker to something like this:

    createMarker (doc, bmp, 0, 'subject', getText (FMP));

    -Rick Quatro

  • When to add keywords to 106,00 images

    I have a new m on Lightroom and 106 000 images in about 2000 records in a complex tree of the Windows folder.  The folder tree will provide at least 2 or 3 keywords for each image in a particular folder.

    Should I add keywords by a folder at the bottom of the tree that I import?

    or

    Import tree of the entire folder with subfolders and then make the Keywords in Lightroom after importation.

    or

    Take the middle ground and add tags to files of top-level only, I import and then do the work on subfolders and the sub-sub folders later in Lightroom. I don't know that I have will simplify considerably the TRIE, once I'm in Lightroom.

    If one of them approached would work, is there a time saving using an approach?

    A hint of Ben Willmore (Alexei_tchernomor)-

    Only the key word your "Star rated" images - the photos that you want to use in the future. Makes short work of keywording. (IF you applied the star ratings!)

  • How to search for an image Adobe Stock based on the number of files Adobe Stock?

    Before I signed up for Adobe Stock, I took screenshots of the pictures that I wanted to buy. These plans include the official file Adobe Stock number. Now that I have a subscription, I want to buy these images. But it doesn't seem to be an option to search based on the file number. How can I get the image I want, by file number, without wasting hours of research of individual images through keywords?

    Simply type the Stock number in the search. Be sure to have audited as well appropriate file types.

Maybe you are looking for

  • The DVD of my Tecra A3 firmware update.

    I couldn't use the update of the current firmware on my drive UJ-830 s the program tell me that the "target drive is not connected", what should I do?

  • MAX: Fehler bei der zur data base connection

    Hallo, ICH habe ein problem mit NI MAX. Es scheint die nimxs.exe zu breast beschadigt. Nach dieser Fehlermeldung NI MAX nicht mehr gestartet werden kann. ES geht nicht mehr über die Initialisierung headed. Die Fehlermeldung participations beim der na

  • Windows Update freeze on step 2 of 3 0% complete for more than 30 minutes. Help for repair?

    Whenever I'm doing a windows update on Vista Home Premium 64-bit. At closing, it jumps to step 2 of 3 then is usually stuck on 0%, I let this go for about 30 minutes, then manually restart my computer and updates seem to install fine. But the most re

  • HP Mini 1000 model # 1030nr HELP!

    I just got my old laptop storage. When I get it turned on, it is on the BIOS screen and asks me to enter the current password. I entered my password of windows, and after 3 failed attempts, he gave me this message-Password check failedFatal error...

  • Automation of workflow in the elements

    HelloI am trying to automate a workflow moderately complex in Prime Minister 11 Adobe elements.Essentially, I need to:Call a few external command line programs to prepare some media files.Import them into elements.Place/sequence of them while playing