6 Replies Latest reply on Feb 5, 2018 12:47 AM by Kukurykus

    Way to have the "create just date " to print into photo?

    Kukurykus Adobe Community Professional

      Way to have the "create just date " to print into photo?

      Metadata > Date Created

      bottom right corner write (sample : 31.01.2018)

      Thank you...

       

      Question asked by idjev and then deleted. Here's the answer:

       

      (aD = activeDocument).artLayers.add().kind = LayerKind.TEXT
      d = aD.info.creationDate.replace(/(\d{4})(\d{2})(\d{2})/,
      function(_, v1, v2, v3, v4){return v3 + '.' + v2 + '.' + v1});
      s = ((h = aD.height) / 100 * 5) * (72 / aD.resolution);
      (tI = aD.activeLayer.textItem).contents = d, tI.size =  s;
      (w=aD.width)>(h=aD.height)?(a=8,b=9):(a=6,b=9.5)
      tI.position = [w / 10 * a, h / 10 * b], col = new SolidColor
      tI.color = col.rgb.hexValue = 'FF0000'
      
        • 1. Re: Way to have the "create just date " to print into photo?
          dominique filiol Level 2

          Bonjour Kukurykus !

           


          When I change the digital camera the numbers of information I want to publish change

           

          So I use this script: I use this script:

           

          [code]savedUnits=app.preferences.rulerUnits;
          var thisDoc=app.activeDocument;
          app.preferences.rulerUnits=Units.PIXELS;

           

          // EXIF_info.jsx
          //pour connaitre les numeros des informations exif de son appareil
          // numeros a modifier dans la fonction InfoExif() du script Exif_New.jsx

           

          var exif_info="";

           

          for (var e = 0; e < thisDoc.info.exif.length; e++){
          try
          {
          var j = e ;
          if ( j<10 )
          {
            exif_info =  exif_info + "N° " + j + "   " +thisDoc.info.exif[e][0] + " = " + thisDoc.info.exif[e][1] + "\r";
          }
          else
          {
            exif_info =  exif_info + "N° " + j + "  " +thisDoc.info.exif[e][0] + " = " + thisDoc.info.exif[e][1] + "\r";
          }
          }
          catch (e) {}
          }

           

          // alert(thisDoc.info.exif);
          text_layer=thisDoc.artLayers.add();
          text_layer.kind = LayerKind.TEXT;
          textColor = new SolidColor;
          textColor.rgb.red = 0;
          textColor.rgb.green = 0;
          textColor.rgb.blue = 0;
          text_layer.textItem.color = textColor;
          text_layer.textItem.kind=TextType.PARAGRAPHTEXT;
          text_layer.textItem.position = Array(thisDoc.width * 0.05, thisDoc.height * 0.05);
          text_layer.textItem.size = 18; //a la place de 4
          text_layer.textItem.font = "ArialMT";
          text_layer.textItem.width = thisDoc.width * 0.8
          text_layer.textItem.height = thisDoc.height * 0.8
          text_layer.textItem.contents=exif_info;

           

          // restore preferences
          app.preferences.rulerUnits=savedUnits;

           


          [/code]

          • 2. Re: Way to have the "create just date " to print into photo?
            idjev Level 1

            quotation :  Dear  Paul MR   (Script Master) ....

            Thanks

             

            #target photoshop;
            if(documents.length){
            if (ExternalObject.AdobeXMPScript == undefined) ExternalObject.AdobeXMPScript = new ExternalObject('lib:AdobeXMPScript');
            var xmp = new XMPMeta(activeDocument.xmpMetadata.rawData); 
            if( xmp.doesPropertyExist(XMPConst.NS_XMP, "CreateDate" ) ) {
            var date = new Date(new XMPDateTime(xmp.getProperty( XMPConst.NS_XMP, "CreateDate" ).toString()).getDate().getTime());
            var m = date.getMonth() + 1;
            var month = (m < 10) ? '0' + m : m;
            var yy = date.getYear();
            var dom = date.getDate();
            var dayM = (dom < 10) ? '0' + dom : dom;
            var year = (yy < 1000) ? yy + 1900 : yy;
            var FontName = "Arial"; 
            var FontSize = 16;
            var black = new SolidColor(); 
            black.rgb.hexValue = '000000'; 
            newTextLayer = activeDocument.artLayers.add(); 
            newTextLayer.kind = LayerKind.TEXT; 
            newTextLayer.textItem.kind = TextType.POINTTEXT
            newTextLayer.textItem.color = black; 
            newTextLayer.textItem.font = FontName;
            newTextLayer.textItem.size = FontSize; 
            newTextLayer.textItem.contents=dayM+"."+month+"."+year;
            activeDocument.selection.selectAll();
            align('AdRg');
            align('AdBt');
            activeDocument.selection.deselect();
            activeDocument.activeLayer.translate (-10, -10);
            }else{
                alert("sorry this document does not have the create date!");
                }
            }
            function align(method) { 
            var desc = new ActionDescriptor();
            var ref = new ActionReference();
            ref.putEnumerated( charIDToTypeID( "Lyr " ), charIDToTypeID( "Ordn" ), charIDToTypeID( "Trgt" ) ); 
            desc.putReference( charIDToTypeID( "null" ), ref ); 
            desc.putEnumerated( charIDToTypeID( "Usng" ), charIDToTypeID( "ADSt" ), charIDToTypeID( method ) );
            executeAction( charIDToTypeID( "Algn" ), desc, DialogModes.NO ); 
            };
            
            
            1 person found this helpful
            • 3. Re: Way to have the "create just date " to print into photo?
              Kukurykus Adobe Community Professional

              There is mistake in last line of my code. To make it to work, change that to:

               

              col.rgb.hexValue = 'FF0000' , tI.color = col
              

               

               

              You can also change 3rd before end line (to make better look) to:

               

              (w=aD.width)>(h=aD.height)?(a=8,b=9.5):(a=6.75,b=9.75)
              
              • 4. Re: Way to have the "create just date " to print into photo?
                dominique filiol Level 2

                Thank you Kukurykus!

                It's better like this .....

                Can you put the script fixes on the post?

                • 5. Re: Way to have the "create just date " to print into photo?
                  Kukurykus Adobe Community Professional
                  (aD = activeDocument).artLayers.add().kind = LayerKind.TEXT
                  d = aD.info.creationDate.replace(/(\d{4})(\d{2})(\d{2})/,
                  function(_, v1, v2, v3, v4){return v3 + '.' + v2 + '.' + v1});
                  s = ((h = aD.height) / 100 * 5) * (72 / aD.resolution);
                  (tI = aD.activeLayer.textItem).contents = d, tI.size =  s;
                  (w=aD.width)>(h=aD.height)?(a=8,b=9.5):(a=6.75,b=9.75)
                  tI.position = [w / 10 * a, h / 10 * b], col = new SolidColor
                  col.rgb.hexValue = 'FF0000' , tI.color = col
                  
                  • 6. Re: Way to have the "create just date " to print into photo?
                    idjev Level 1

                    Thanks  Kukurykus ..

                     

                        (aD = activeDocument).artLayers.add().kind = LayerKind.TEXT  
                        d = aD.info.creationDate.replace(/(\d{4})(\d{2})(\d{2})/,  
                        function(_, v1, v2, v3, v4){return v3 + '.' + v2 + '.' + v1});  
                        s = ((h = aD.height) / 100 * 5) * (72 / aD.resolution);  
                        (tI = aD.activeLayer.textItem).contents = d, tI.size =  s;  
                        (w=aD.width)>(h=aD.height)?(a=8,b=9.5):(a=6.75,b=9.75)  
                        tI.position = [w / 10 * a, h / 10 * b], col = new SolidColor  
                        col.rgb.hexValue = 'FF0000' , tI.color = col