Using Beyond Compare with UEStudio

Using Beyond Compare with UEStudio

1
NewbieNewbie
1

    Aug 08, 2015#1

    I have version 14.00.0.1012 of UEStudio. I would like to use Beyond Compare as the default compare tool when I want to compare the text in two files that I am editing. (About the only thing I ever use UltraCompare for.)

    I did a Google search, as well as a forum search, and found several posts on the subject, all 2010 or earlier.

    I tried the Uedit32.ini [Settings] change detailed elsewhere but never got it to open Beyond Compare. (No errors, warnings, on anything. It just kept using UltraCompare.) I can open Beyond Compare by adding it as a tool.

    Am I missing something, or is not possible to have UEStudio open Beyond Compare to compare the highlighted text?

    6,600548
    Grand MasterGrand Master
    6,600548

      Aug 08, 2015#2

      Do you have read everything in External diff program / compare tool including my last post if Beyond Compare is installed in a directory with 1 or more spaces in path like C:\Program Files...?

      I'm also confused about: I tried the Uedit32.ini [Settings] change

      You have to edit %APPDATA%\IDMComp\UEStudio\UEStudio.ini with Notepad or UltraEdit while UEStudio is not running. Uedit32.ini is for UltraEdit and not for UEStudio.

      Which version of UltraCompare do you have installed, Professional or just Lite?

      UC Lite is installed together with UEStudio, but UC Professional must be installed and licensed separately. I have never tried if it is possible to use a third-party comparison tool with UC Prof. installed. It could be that UE/UES ignores Compare EXE in [Settings] if UC Professional is installed. This can be tested by renaming temporarily registry key

      HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\App Paths\uc.exe

      with Regedit.exe to something different like uc_ignore.exe or whatever you want.

      But don't forget to rename this key back to uc.exe before uninstalling UltraCompare Professional which would be the standard method to remove this key.

      Last, I don't know if comparing selected (highlighted) text is available also with a third-party comparison tool. It could be that just entire files can be compared with a third-party comparison tool.
      Best regards from an UC/UE/UES for Windows user from Austria

      79
      Advanced UserAdvanced User
      79

        Aug 11, 2015#3

        If you use the "Compare EXE=" setting in UEStudio.ini (or uedit32.ini if you're using UltraEdit) to specify a custom comparison program, you will no longer have the option of comparing selected text.

        As a start to working around this problem if instead of adding a "Compare EXE=" setting, you replace ucl.exe with your own program (backup ucl.exe first, of course) that dumps command line arguments and run a normal file comparison, you'll see that "UltraCompare Lite" is invoked with arguments that look like:

        Code: Select all

        arg[0]: "C:\Program Files (x86)\IDM Computer Solutions\UEStudio\ucl.exe"
        arg[1]: "-t"
        arg[2]: "C:\temp\launchbc.c"
        arg[3]: "C:\temp\echoargs.c"
        arg[4]: "-rio"
        arg[5]: "-v1253576624"
        arg[6]: "-cfd"
        arg[7]: "|-1|-1|-1|-13|0|0|0|400|0|0|0|0|0|0|♣|1|Courier New|0|"
        
        I have no idea what most of those arguments are, but it's clear where the files to be compared are. With this information, you can replace ucl.exe with your own program that launches Beyond Compare instead. Here's a simple example that performs no error handling and probably has some bugs:

        Code: Select all

        #include <stdlib.h>
        #include <stdio.h>
        #include <string.h>
        
        #include <windows.h>
        
        
        char bc_prog[] = "C:\\Program Files (x86)\\Beyond Compare 4\\BComp.exe";
        
        
        
        int main( int argc, char** argv)
        {
            BOOL result;
            
            int len = strlen(bc_prog) + strlen(argv[2]) + strlen(argv[3]) + 10;
            
            char* cmdline = malloc(len);
        
            PROCESS_INFORMATION ProcessInfo; //This is what we get as an [out] parameter
            STARTUPINFO StartupInfo; //This is an [in] parameter
        
            ZeroMemory(&StartupInfo, sizeof(StartupInfo));
            StartupInfo.cb = sizeof StartupInfo ; //Only compulsory field
            
            sprintf(cmdline, "\"%s\" \"%s\" \"%s\"", bc_prog, argv[2], argv[3]);
            
            result = CreateProcess( 
                        bc_prog,
                        cmdline,
                        NULL,
                        NULL,
                        FALSE,
                        0,
                        NULL,
                        NULL,
                        &StartupInfo,
                        &ProcessInfo
                    );
            
            if (!result) {
                puts("The process could not be started...");
            }  
            else {
                //WaitForSingleObject(ProcessInfo.hProcess,INFINITE);
                CloseHandle(ProcessInfo.hThread);
                CloseHandle(ProcessInfo.hProcess);
            }
            
           return 0;
        }
        
        Now, since you're interested in being able to use Beyond Compare to compare selected portions of files open in UEStudio, you'll note that in that case the arguments passed to the compare program by UEStudio are:

        Code: Select all

        arg[0]: "C:\Program Files (x86)\IDM Computer Solutions\UEStudio\ucl.exe"
        arg[1]: "-t"
        arg[2]: "C:\Users\mikeb\AppData\Local\Temp\C__temp_echoargs.c0\C__temp_echoargs.c"
        arg[3]: "C:\Users\mikeb\AppData\Local\Temp\C__temp_launchbc.c0\C__temp_launchbc.c"
        arg[4]: "-title1"
        arg[5]: "C:\temp\echoargs.c"
        arg[6]: "-title2"
        arg[7]: "C:\temp\launchbc.c"
        arg[8]: "-rio"
        arg[9]: "-v1717702579"
        arg[10]: "-cfd"
        arg[11]: "|-1|-1|-1|-13|0|0|0|400|0|0|0|0|0|0|♣|1|Courier New|0|"
        
        So temporary files are passed as well as titles to use in the compare program. BC can handle this, but my little wrapper program does not - you'll see the ugly temporary filenames unless you modify the program to look for the "-title" arguments and pass them on.

        I leave such modifications and error handling improvements as an exercise for the reader.