Skip to main content
Inspiring
April 27, 2018
Question

auto date

  • April 27, 2018
  • 3 replies
  • 6204 views

I'm trying to automate the proof sheets we produce as much as possible - I've managed to simplify repetitions using smart objects, but would like to add the date that the file is opened as text .

Is this possible? If so, can someone show a scripting newbie how? I've done more complex stuff in Acrobat, but our proof sheets need to be created in photoshop as they all contain very different/custom content that uses images/technical drawings, measurements, etc.

thanks in advance!

This topic has been closed for replies.

3 replies

Known Participant
April 10, 2019

Great stuff. Works silky smooth on a pc.

The Script runs on a mac, but get the following error:

Cannot execute script in target engine 'main'!

(#1116) Can't start debug session.

The script runs but the name is replace by 'null', which I guess could be a username issue?

Am on Photoshop 2019 on mac and 2018 on pc if that helps.

Cheers

Steve

Known Participant
April 10, 2019

Just for your info.

The script seems to work most of the time, but still having a few issues:

On one file a text layer is created with the correct info, but no dupe merge is carried out.

Have had a few runs of the script where all layers are selected, without the dupe merge.

And a couple of instances where the merge gets copied on to the existing top layer.

Thanks again.

Steve

Known Participant
April 10, 2019

As a second option, would it be possible to give us just the renaming part of the script?

Then we could create the dupe merge in an Action, and sit the renaming Script at the end of the Action?

Cheers

Steve

SuperMerlin
Inspiring
April 28, 2018

Photoshop layers are time stamped when they are updated. Would this do what you want?

$.writeln(getLayerChangedDate());

function getLayerChangedDate(){

   var ref = new ActionReference();

   ref.putProperty( charIDToTypeID( "Prpr" ), stringIDToTypeID( "metadata" ) );

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

   var desc = executeActionGet( ref );

   if ( desc.hasKey( stringIDToTypeID( "metadata" ) ) ){

      var descMetadata = desc.getObjectValue( stringIDToTypeID("metadata" ));

      var timeInSeconds = descMetadata.getDouble( stringIDToTypeID("layerTime") );

      var d = new Date();

      d.setTime( timeInSeconds * 1000.0 );

      return d.toLocaleString();

   }

};

Inspiring
April 30, 2018

thanks -  I see how you can add a script via file>scripts>browse but don't see how you can make that change a text box on the page to show the current date. can you advise? I've never used scripts in photoshop before.

JJMack
Community Expert
Community Expert
April 28, 2018

If you have scripted your proof sheets using Photoshop scripting  where you create a composite layered document that containing your images as smart object layers there should be no problem adding additional script code to expand the documents canvas and add a text layer to add  a date in the added canvas area and also save the PSD with a filename that includes the date. If ilu just need to tile out your images  You could look into Contact Sheet II it Photoshop presets scripts folder.

JJMack
Inspiring
April 30, 2018

thanks, the contact sheet won't do what I need though.  I have everything organized except the auto date. I have no idea how to do that. I've never scripted in photoshop before, I've figured out how to add a script, but not to just the current file, I see how you can add a script via file>scripts>browse but don't see how you can make that change a text box on the page to show the current date.

JJMack
Community Expert
Community Expert
April 30, 2018

it might be easy if you know how, I'm asking how :-)

Not sure how the document is relevant, but I've attached a jpeg of it. The date would be in the bottom left corner in the box.

thanks


Your jpeg is just a flat rendering of your layered documents layers composite view. Your script would need to update or add layers to you layered document that you provide no information about. You could add a text layer containing the date over the date area in the bottom left of your jpeg if all your documents are the same size and aspect ratio and the date area is in  the same location in all documents.

The jpeg you posted is only 1093px by 847 px 15.1" by 11.8" at  print resolution of 72 DPI which I find hard to believe  is the a size you want. It would be a soft print and an image most likely to large for Web use.

JJMack