I did not post my action timer script because Adobe design in an intentional bug in Photoshop CC 2015.5 Scripting. It one thing to let a bug out unknowingly I do not why Adobe did it. The reason the posted was it bad to remove metadata like copyright information. Yet Photoshop save for web does that by default. I do not do that I try to remove my metadata however, Adobe scripting will no longer set a metadata files to empty its default state. I can use Photoshop Adobe File Info to set Copyright data to anything that I want it does not make the image mine nor does Copyright info protect anyone's image the Law and the courts do that. I get around Adobe bug by adding Garbage in every document I edit info metadata field using Adobe Script event manager. So all my run twice scripts will work in CC 2015.5 and CC 2017.
It will add a little over a second to your actions play time.
So here my script if it does not work for you its Adobe's bug not my code.
/* =============================================================================================
// 2010 John J. McAssey (JJMack) http://www.mouseprints.net/
//
// This script is supplied as is. It is provided as freeware.
// The author accepts no liability for any problems arising from its use.
//
// This script is designed to be used by a Photoshop Action twice
// A good pratice to use when creating an actions that use this scipt is for the action
// not to do a save or play some other action between its two useages of this Script.
//
// The first time this script is used by an action the currend date and time
// are saved into the document's meta-data Info Instructions field.
//
// The second time this script used by the action this script retreives the date and time
// that was saved in the meta-data during the first usage.
// The script Outputs an Action duration message to Alerts the user of the time it took.
// Logs the Action Times into the ActionTime.log file in the folder where the script resides.
// Then the saved date and time is removed from the document's meta-data Info Instructions field.
//
// ============================================================================================== */
/*
<javascriptresource>
<about>$$$/JavaScripts/ActionTime/About=JJMack's ActionTime^r^rCopyright 2010 Mouseprints.^r^rRun twice script utility for action.^rNOTE:Don't play other actions between runs!^r^rFirst Run records Actions Start Time.^rSecond Run removes start time recording and outputs an execution time message.</about>
<enableinfo>true</enableinfo>
<category>JJMack's Action Run Twice Utility</category>
</javascriptresource>
*/
if (app.documents.length > 0) { // LOGFile faild trying this --> app.activeDocument.suspendHistory('ActionTime','main()');
if (app.activeDocument.info.instructions.indexOf("<ActionTime>") == -1 ){ // no footprint fisrt useage
//alert("first");
// Retreive Date Time for Foot Print
var stime = new Date().getTime();
//alert("Time = " + stime );
StartTime = timeStamp() ;
// put footprint in metadata info instructions
app.activeDocument.info.instructions = app.activeDocument.info.instructions + "<ActionTime>" + StartTime + "</ActionTime>" + "<ClockTime>" + stime + "</ClockTime>";
//alert( "Saved =" + "<ActionTime>" + StartTime + "</ActionTime>"+ "<ClockTime>" + stime + "</ClockTime>");
}
else {
//alert("second");
var etime = new Date().getTime();
//alert("Time = " + etime );
EndTime = timeStamp();
// Retreive saved information
ActionTimeOffset = app.activeDocument.info.instructions.indexOf("<ActionTime>") + "<ActionTime>".length;
ActionTimeLength = app.activeDocument.info.instructions.indexOf("</ActionTime") -ActionTimeOffset;
StartTime = app.activeDocument.info.instructions.substr(ActionTimeOffset, ActionTimeLength);
ClockTimeOffset = app.activeDocument.info.instructions.indexOf("<ClockTime>") + "<ClockTime>".length;
ClockTimeLength = app.activeDocument.info.instructions.indexOf("</ClockTime") -ClockTimeOffset;
stime = app.activeDocument.info.instructions.substr(ClockTimeOffset, ClockTimeLength);
duration = ((etime - stime)/1000);
alert("ActionTime \rStart = " + StartTime + " \rEnd = " + EndTime + " \rTime = " + duration + " Seconds");
// Log Edit Session into Log File
var scriptLocation = findScript()+ "0";
var LOGFilePath = scriptLocation.slice(0,-4) + "log";
var LOGFile = File(LOGFilePath);
writeLOG(app.activeDocument.name + " Start=" + StartTime + " End=" + EndTime + " Time=" + duration + " Seconds\r")
// End log File
// Remove footprint from metadata info instructions
before = app.activeDocument.info.instructions.substr(0,app.activeDocument.info.instructions.indexOf("<ActionTime>"));
afterOffset = app.activeDocument.info.instructions.indexOf("</ClockTime>") + "</ClockTime>".length;
after = app.activeDocument.info.instructions.substr(afterOffset, app.activeDocument.info.instructions.length - afterOffset);
//alert ("before = " + before + " after = " + after);
app.activeDocument.info.instructions = before + after;
}
}
else { alert("You must have at least one open document to run this script!"); }
///////////////////////////////////////////////////////////////////////////////
// main function
///////////////////////////////////////////////////////////////////////////////
function main(){
}
///////////////////////////////////////////////////////////////////////////////
// END - main function
///////////////////////////////////////////////////////////////////////////////
function timeStamp(){
// Get the time and format it
var digital = new Date();
var hours = digital.getHours();
var minutes = digital.getMinutes();
var seconds = digital.getSeconds();
var amOrPm = "AM";
if (hours > 11) amOrPm = "PM";
if (hours > 12) hours = hours - 12;
if (hours == 0) hours = 12;
if (minutes <= 9) minutes = "0" + minutes;
if (seconds <= 9) seconds = "0" + seconds;
// Get the date and format it
var date = new Date();
var d = date.getDate();
var day = (d < 10) ? '0' + d : d;
var m = date.getMonth() + 1;
var month = (m < 10) ? '0' + m : m;
var yy = date.getYear();
var year = (yy < 1000) ? yy + 1900 : yy;
// create a variable with the fully formatted the time and date
// todaysDate = hours + ":" + minutes + ":" + seconds + " " + amOrPm + " - " + day + "/" + month + "/" + year;
// todaysDate = hours + ":" + minutes + ":" + seconds + " " + amOrPm + " - " + month + "/" + day + "/" + year;
MonthNames = new Array("January","February","March","April","May","June","July","August","September","October","November","December");
todaysDate = hours + ":" + minutes + ":" + seconds + " " + amOrPm + " " + MonthNames[date.getMonth()] + " " + date.getDate() + ", " + year;
return todaysDate;
}
// Find the location where this script resides
function findScript() {
var where = "";
try {
FORCEERROR = FORCERRROR;
}
catch(err) {
// alert(err.fileName);
// alert(File(err.fileName).exists);
where = File(err.fileName);
}
return where;
}
// Write LOG file
function writeLOG(log) {
try {
if(LOGFile.exists) {
LOGFile.open ("e");
LOGFile.seek (0,2); // Move to EOF
} else {
LOGFile.open ("w"); // Add unicode marker if we change to LOG file format for this log file
}
LOGFile.encoding = "UTF8"; // set UTF8
LOGFile.write(log);
LOGFile.close();
} catch (e) {
alert(e);
} finally {
}
return;
}
.