I played around with the freeware AutoIt to create some scripts for XML Validator Buddy to automate certain validator tasks. As a first idea I wanted to call the XML validator for all files with *.xml as extension clicking a single button. The following steps are required:
- I had to fill the find field with “*.xml”.
- Send ENTER to the “Find” button.
- Call the XML validator using F8.
The simple AutoIt script below is doing this in XML Validator Buddy:
#include <Constants.au3> Local $cNewLine = chr(10) & chr(13) ; Prompt the user to run the script Local $iAnswer = MsgBox(BitOR($MB_YESNO, $MB_SYSTEMMODAL, $MB_ICONINFORMATION), "XML ValidatorBuddy", "This script shows you how to quickly validate all *.xml files in the current folder." & $cNewLine & $cNewLine & "Do you want to run it?") ; If "No" was clicked (7) then exit the script If $iAnswer = 7 Then Exit EndIf ; Wait for XML ValidatorBuddy become active Local $hValBuddy = WinWaitActive("XML ValidatorBuddy", "", 3) ; filter for *.xml ControlClick($hValBuddy, "", 142) Send("{CTRLDOWN}a{CTRLUP}") Sleep(1500) Send("{BS}") Send("*") Sleep(750) Send(".") Sleep(750) Send("x") Sleep(750) Send("m") Sleep(750) Send("l") Sleep(750) Send("{ENTER}") Sleep(2000) ; select all files in File Explorer WinMenuSelectItem($hValBuddy, "", "File Explorer", "Select all") ; and validate Send("{F8}")
Please note that I added a lot of Sleep() statements to the code but just for demonstration purpose only.
Then I compiled this script and added it as a custom user tool to XML Validator Buddy. I also checked the option to add the tool as a button to the File Explorer window:
This way I can quickly run the XML validator from any folder with a single click.