Schedule Validations or Link Checks

By using a scheduling program, CSE HTML Validator's command line processor can be used to run validations or other jobs at scheduled times.

To schedule a job, you can use the Scheduled Tasks applet in the Windows Control Panel in Windows XP or the Task Scheduler in Vista and Windows 7/8.

TIP: Using the command line processor, you can create a batch file that runs the Batch Wizard and then emails or publishes the results (this may require additional 3rd party software).

For more information, see the Command Line Arguments topic.

Tips

After generating a scheduled Batch Wizard report, the report can automatically be uploaded to a server. See the example below.

Example

This example runs a Batch Wizard job at scheduled times and optionally uploads the report to a server.

Choose a folder (with write permission) to save the needed files which will include a Batch Wizard target list file and a batch file. This example uses the folder C:\Users\(username)\validator, but you could use another folder.

Please note that on 64-bit systems you may need to change "Program Files" to "Program Files (x86)".

hmtoggle_plus1Step 1: Create the Batch Wizard target list file

1.Load CSE HTML Validator and go to the Batch Wizard (F2).

2.Create a target list (or use an existing one). For example, create a new target list (Ctrl+N) add a URL target (like the URL of the website you want to check). For more information, see the Batch Wizard topic.

3.Select the Target List Options tab and set the HTML report filename for this specific target list, if desired (otherwise the default will be used). This example uses the folder C:\Users\(username)\validator\reports and set the HTML report filename option to: C:\Users\(username)\validator\reports\checkwebsite.html

4.Save the target list. For this example, we'll use the folder C:\Users\(username)\validator and the filename checkwebsite.lst

5.Review the Batch Wizard Options (F4) to make sure they are set to what you want. Note that these options are not stored in the target list file so they do not change when different target list files are loaded.

hmtoggle_plus1Step 2: Create the batch file that will be scheduled to run

1.Create an empty batch file and save it. A batch file is a text file containing a series of commands, and can be created using CSE HTML Validator's Editor. For this example, we'll call this script checkwebsite.bat, but it could be named something else (just keep the .bat extension). We'll use C:\Users\(username)\validator\checkwebsite.bat

2.Add a command to the batch file to run the Batch Wizard job created earlier. It should look something like this:
"C:\Program Files\HTMLValidator140\cmdlineprocessor.exe" -msgwindow checkwebsite -b1 "C:\Users\(username)\checkwebsite.lst"

3.The -msgwindow option specifies a unique window name that is used for program communication (in this case the window name is "checkwebsite"). This prevents interference between multiple instances of the program and allows running multiple jobs simultaneously with different window names. Make sure all cmdlineprocessor.exe commands for the same job use the same window name.

4.The -b1 option will run a Batch Wizard validation job.

5.For more information about the command line processor, see the Command Line Arguments topic.

6.Make that any changes to the batch file has been saved.

hmtoggle_plus1Step 3: Schedule the batch file to run

Note: These instructions are based on the Windows 8.1 Task Scheduler.

1.Run the Windows Task Scheduler application.

2.Create a basic task with the name "checkwebsite" (or whatever name you want), and set the schedule/trigger (like daily, weekly, monthly, etc) to when you want to run the Batch Wizard job.

3.Set the task action to 'Start a program' and specify the batch file created earlier as the program/script:
C:\Users\(username)\validator\checkwebsite.bat

4.Set the 'Start in' option to C:\Users\(username)\validator. This is important when working with relative paths (like when uploading the report to a server).

5.Continue through the Task Wizard, selecting 'Finish' when done to create the scheduled task.

6.To edit the task now or in the future, simply right-click on it and choose 'Properties'.

7.To run the task now, in order to check it, simply right-click on it and choose 'Run'. If everything is successful, then the report should be created in the specified location:
C:\Users\(username)\validator\reports\checkwebsite.html

hmtoggle_plus1Upload the report to a server (optional)

SECURITY WARNING: This requires the server password (if any) to be stored in plain text in the batch file.

This requires an SSH server on the server that is receiving the report files.

1.Download pscp.exe from the PuTTY Download Page. NOTE: You may want to download the ZIP file instead, which contains all the binaries and also the help files. This is a command line utility that can securely transfer files from the local system to an Internet server that runs an SSH server.

2.Place pscp.exe in C:\Users\(username)\validator

3.The Batch Wizard job must complete before copying the report files otherwise the report files will not be available. Add this to the batch file to prevent it from continuing before the job is done:
cmd /C "C:\Program Files\HTMLValidator140\cmdlineprocessor.exe" -msgwindow checkwebsite -q

4.Typically, to upload to a server you'll need a username, password, and the server address (like name.domain.com). You'll also need to create the folder on the server that you want to upload the report files to. In this example, we created the folder public_html/reports/checkwebsite where the report files will be uploaded.

5.Add a line like this (with proper replacements of the username, password, server, server folder, and anything else if needed) to the batch file created above:
pscp -batch -pw (password) reports\*.* (username)@(server):public_html/reports/checkwebsite

6.IMPORTANT: Execute the above command manually without the -batch option so pscp.exe will give you the server's fingerprint. If you trust that the computer is the computer you think it is, then answer 'y' to save the key in the registry. Saving the key in the registry will allow the command to work in batch mode. You should only need to do this once unless the key is removed from the registry (like when changing computers) or the server changes.