Skip to main content
Inspiring
April 27, 2018
Question

auto date

  • April 27, 2018
  • 3 replies
  • 6201 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

AG2011b143  wrote

don't see how you can make that change a text box on the page to show the current date.

It easy for a script to get the current date,  What you consider a page where your pages are that have text that needs to be changed to the current date is unknown to us.  You provided no imformation about the document you have created.

It would be very easy to write a script that get the current Date and add a text layer to your document containg the date, Some size, some font and in some position over the canvas as the top most layer.

JJMack