HOW TO: Set Batch Wizard report filename dynamically

Post here if your topic is about CSS HTML Validator but doesn't fit in another forum.
Post Reply
User avatar
Albert Wiersch
Site Admin
Site Admin
Posts: 3414
Joined: Sat Dec 11, 2004 9:23 am
Location: Near Dallas, TX
Contact:

HOW TO: Set Batch Wizard report filename dynamically

Post by Albert Wiersch » Mon Sep 09, 2019 11:35 am

Did you know that the Batch Wizard report filename can be set dynamically using a user function? This is new in 2019/v19.

The report filename can be changed in onFunctionsLoad(). The below example appends a day of the week to the report filename if it contains ".html" or ".xml", so "C:\reports\mywebsite.html" would become something like "C:\reports\mywebsite-Tue.html". If you run daily jobs then this would allow you to always keep the last 7 days of reports.

Code: Select all

function onFunctionsLoad() {
 $day=date('ddd'); // day of week as a three-letter abbreviation
 $_JOB.report.filename=replaceStringNoCase($_JOB.report.filename,'.html','-'+$day+'.html');
 $_JOB.report.filename=replaceStringNoCase($_JOB.report.filename,'.xml','-'+$day+'.xml');
}
All you need to do is create a text file with the above function in it, and then specify that file as a user functions file for any Batch Wizard target list that you want it to apply to. You can specify user function files in the Target List Options tab in the Batch Wizard.

For more information please visit this documentation page:
https://www.htmlvalidator.com/2019/docs ... nsload.htm
Image
Albert Wiersch

Post Reply