Naming Job Output Files with Timestamps in Ambience 4.x

1. Access Ambience Server and Designer:
Ensure that both the Ambience 4 Server and Ambience Designer are running. Log in to the Ambience Server for both applications.

2. Open the Job in Ambience Designer:
Navigate to your .job file in the right-hand user panel within Ambience Designer. Double-click the .job file to open the design panel.

3. Modify the File Naming Script:
On the design panel, locate the Script section under the FileLoop attribute.

In the JavaScript editor, insert the following code snippet to dynamically generate file names based on the current date:

mydate= new Date()
theyear = mydate.getFullYear()
themonth = mydate.getMonth() + 1
thetoday = mydate.getDate()
year = theyear.toString();
month = themonth.toString() ;
today = thetoday.toString();

theseconds = mydate.getSeconds()
theminutes = mydate.getMinutes()
thehours = mydate.getHours()
seconds = theseconds.toString();
minutes = theminutes.toString();
hours  = thehours.toString();

var datetime = "_" + year + month + today + "_" + hours + ":" + minutes + ":" + seconds

// To retain directory structure
newFileName = FileName.replace(/.rml/g,datetime+".pdf");
// To flatten directory structure
// newFileName = FileName.replace(/.*\/(.*).rml/g,"$1-"+datetime+".pdf");

The above script will dynamically generate file names with the format YYYYMMDD.pdf. You can customize this structure further if needed.

4. Test the Configuration:
Return to the user panel and locate your .job file. Right-click the .job file and select Run.

5. Verify Output:
Check the Ambience server logs for the latest render and and click Open to view the log details.

In the Result section, you should see the path to the rendered file with the dynamically assigned name.