AutoHotkey: XML tidy for TC File Compare tool

From TotalcmdWiki
Jump to navigation Jump to search

This script helps when comparing XML files in TC's built-in file compare tool, by running tidy on (a temp copy) of both files, making it much easier to compare them line by line. The hotkey in the script below is F4 by default. Needs tidy.exe to be in the path (otherwise edit the RunWait lines below).

#IfWinActive ahk_class TFileCompForm			; tidy XML files for easier compare
	F4::
		ControlGetText sFile2, TAltEdit1
		ControlGetText sFile1, TAltEdit2
		FileCopy, %sFile1%, %A_Temp%\_tc\left.xml, 1
		FileCopy, %sFile2%, %A_Temp%\_tc\right.xml, 1
		RunWait % "tidy -m -xml """ A_Temp "\_tc\left.xml"""
		RunWait % "tidy -m -xml """ A_Temp "\_tc\right.xml"""
		ControlSetText TAltEdit2, %A_Temp%\_tc\left.xml
		ControlSetText TAltEdit1, %A_Temp%\_tc\right.xml
		Send !c!y!n
		Return
#IfWinActive


Back to AutoHotkey