By using a scheduling program like the Task Scheduler app in Windows, CSS HTML Validator's command line processor can be used to run validations or other jobs at scheduled times.
For example, you can use the command line processor to create a batch file that runs a Batch Wizard job and then emails, uploads (to a web server or other server), and/or publishes the report (this may require additional 3rd party software). You can then schedule this batch file to run at specific times. See the example below.
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.
1.Load CSS 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. |
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 CSS 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: 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. |
NOTE: If you do not see the GUI when the task runs and you want to see it then make sure that the task is set to run under the user account that is logged on and the 'Run only when user is logged on' option is selected. Instructions based on the Windows 10/11 Task Scheduler: 1.Run the Task Scheduler desktop app. 2.Choose a folder under Task Schedule Library (or create a new folder with Action > New Folder) to create your new task in (we recommend a folder named "CSS HTML Validator"). 3.Right-click on the folder that you want your new task in and choose Create Basic Task.... 4.In the wizard that appears, set the task name to "checkwebsite" (or whatever name you want), and set the trigger (like daily, weekly, monthly, etc) to when you want to run the Batch Wizard job. 5.Set the task action to Start a program and specify the batch file created earlier as the program/script: 6.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). 7.Continue through the Task Wizard and select Finish when done. The new task should be created. 8.To edit the task now or in the future, simply right-click on it and choose Properties. 9.To run the task now, in order to check it, right-click on it and choose Run. If everything is successful, then the report should be created in the specified location: Older instructions 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: 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, right-click on it and choose Run. If everything is successful, then the report should be created in the specified location: |
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 (new window). 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: 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: 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. |