Skip to content

Instantly share code, notes, and snippets.

@dstj
Last active December 21, 2015 18:19
Show Gist options
  • Save dstj/6346872 to your computer and use it in GitHub Desktop.
Save dstj/6346872 to your computer and use it in GitHub Desktop.
This AutoHotKey script facilitates comparing Resharper tests results where one-liner JSON are compared by copy-pasting them, formatting them and comparing them in Notepad++ with the Compare plugin.
; Copy Paste Resharper tests one-liner JSON exptected vs actual output and compare them in Notepad++
; Use by first copying ALL test output in the clipboard, and then press CTRL-ALT-WIN-C
^#!c::
; Start Notepad++
ProgramFilesX86 := A_ProgramFiles . (A_PtrSize=8 ? " (x86)" : "")
Run %ProgramFilesX86%\Notepad++\notepad++.exe -multiInst -nosession
WinWaitActive, new 1 - Notepad++, , 1
Send ^!d
Sleep, 100
; Paste in new document
Send ^n
Sleep, 100
Send ^v
; Delete extra stuff
Send ^{Home}
Send {Down}{Down}
Send ^+{End}
Send {Del}
Send !+{Right 13}!+{Up 2}
Send {Del}
Send {End}{Backspace}
Send {Down}{End}{Backspace}
; Extract JSON to compare
Send {Home}
Send +{End}
Send ^x
; Format first JSON
Send ^a
Send ^!+m
Sleep, 100
Send ^{Home}
Send Expected
; Paste second JSON and format
Send ^n
Sleep, 100
Send ^v
Send ^a
Send ^!+m
Sleep, 100
Send ^{Home}
Send Actual
; Compare JSON
Send !d
@christianrondeau
Copy link

To solve an issue where starting a comparison while a notepad++ instance is already open, this fork will always start a new no-session instance of notepad++: https://gist.github.com/christianrondeau/6353811

@christianrondeau
Copy link

Thanks for merging! I deleted my fork.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment