Jump to content

Quick Compare using Cliboard Contents


zfisherdrums
 Share

Recommended Posts

All,

With regard to coding, scripting, etc - cut-and-paste is a sin. At least it is to me. And some others as well. Even so, I do what I should not do.

I ran into a scenario where I needed to confirm if two areas of text were the same. Furthermore, the text was in the same document, so WinMerge, DiffDoc, BeyondCompare were out. It occurred to me that this quick and dirty script may be useful if one needs to compare areas of text that are too large to confirm quickly. Behold the fruits of 12 days of laborious scripting activity*!

HotKeySet( "^!{LEFT}", "StoreClipboardContentsA" )
HotKeySet( "^!{RIGHT}", "StoreClipboardContentsB" )
HotKeySet( "^!{DOWN}", "CompareContents" )

Global $g_sClipboardA = ""
Global $g_sClipboardB = ""

While 1
    Sleep( 250 )
Wend

Func StoreClipboardContentsA()
    Send( "^c" )
    $g_sClipboardA = ClipGet()
    SoundPlay(@WindowsDir & "\media\ding.wav",1)
EndFunc

Func StoreClipboardContentsB()
    Send( "^c" )    
    $g_sClipboardB = ClipGet()  
    SoundPlay(@WindowsDir & "\media\ding.wav",1)
EndFunc

Func CompareContents()  
    If $g_sClipboardA == $g_sClipboardB Then
        MsgBox(0, @ScriptName, "Compared contents are the same" )
    Else
        MsgBox(48, @ScriptName, "Compared contents are different" )
    EndIf 
EndFunc

* 12 metric days = 5 minutes.

Ctrl+Alt+Left stores clipboard contents into "A".

Ctrl+Alt+Right stores clipboard contents into "B".

Ctrl+Alt+Down does a case-sensitive comparison.

Link to comment
Share on other sites

If exists the differences it would be very nice to show them.

Anyway, simple and easy to use. :)

EDIT: and write a function to exit from program :o

Thanks for the feedback!

With regards to what diff'd, I only wanted to confirm that a diff exists. And as far as an exit function is concerned, I was more than happy with the tray icon's Exit function.

Zach Fisher....

Edited by zfisherdrums
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...