• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

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

LEGEND ,
Feb 03, 2018 Feb 03, 2018

Copy link to clipboard

Copied

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'

TOPICS
Actions and scripting

Views

903

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Contributor ,
Feb 04, 2018 Feb 04, 2018

Copy link to clipboard

Copied

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[0] + " = " + thisDoc.info.exif[1] + "\r";
}
else
{
  exif_info =  exif_info + "N° " + j + "  " +thisDoc.info.exif[0] + " = " + thisDoc.info.exif[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]

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Feb 04, 2018 Feb 04, 2018

Copy link to clipboard

Copied

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 );

};

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 04, 2018 Feb 04, 2018

Copy link to clipboard

Copied

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)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Feb 05, 2018 Feb 05, 2018

Copy link to clipboard

Copied

Thank you Kukurykus!

It's better like this .....

Can you put the script fixes on the post?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 05, 2018 Feb 05, 2018

Copy link to clipboard

Copied

(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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Feb 05, 2018 Feb 05, 2018

Copy link to clipboard

Copied

LATEST

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines