Jump to content

Recommended Posts

Posted

If you need to compare two files using WinMerge, you can use the _WinMergeCompare2Files function as in the following example:

_Example()

Func _Example()
    FileCopy(@ScriptFullPath, @ScriptFullPath & '.txt')
    FileWrite(@ScriptFullPath & '.txt', @CRLF & 'TEST' & @CRLF & @CRLF)
    _WinMergeCompare2Files(@ScriptFullPath, @ScriptFullPath & '.txt')
EndFunc   ;==>_Example

Func _WinMergeCompare2Files($sLeftFilePath, $sRightFilePath, $fWaitForWinMerge = True) ; Left is orginal , Right is new
    Local Const $sWinMergeParamsKey = 'HKEY_CURRENT_USER\Software\Thingamahoochie\WinMerge'
    If FileExists($sLeftFilePath) And FileExists($sRightFilePath) Then
        Local Const $sWinMergeExecutable = RegRead($sWinMergeParamsKey, 'Executable')
        Local Const $sFileName = StringRegExp($sLeftFilePath, '(?i).*\\(.*)', 3)[0]
        Local Const $sWinMergeParams = _
                ' /u /e /xq /wl /maximize /dl "Original:   ' & $sFileName & '" /dr "New version:   ' & $sFileName & '" ' & _
                '"' & $sLeftFilePath & '"' & ' ' & '"' & $sRightFilePath & '"'
        If $fWaitForWinMerge Then
            ShellExecuteWait($sWinMergeExecutable, $sWinMergeParams)
        Else
            ShellExecute($sWinMergeExecutable, $sWinMergeParams)
        EndIf
    EndIf
EndFunc   ;==>_WinMergeCompare2Files

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted

Nice mlipok! I didn't realise it before but (?i) isn't necessary as you're not match any word.

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

Posted
You're right.
But it's such a habit.

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

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
×
×
  • Create New...