Results 1 to 10 of 10
  1. #1
    Join Date
    Feb 2013
    Posts
    12

    Default Support for ConsoleOutput (instead of using '%t')

    Is there a way so BC is directly using the output some tool like pngcheck.exe writes to the console?

    I find it a little crumb some and error prune to just have to add some file like
    pngcheck.cmd
    Code:
    "%~dpn0.exe"  %3 %4 %5 %1 >%2
    that does nothing more than pass all(or at least some) of the arguments to the console program and
    redirecting the output to a file.
    I mean well I could also include some 'Gimmicks' like
    Code:
    reg delete ^
    	"HKCU\Software\Scooter Software\Beyond Compare 4" ^
    	/v CacheID ^
    	/f
    to make the call of pngcheck.cmd a little bit more 'useful'

    Suggestion:
    * What about making BC to use the 'stdout' in case there's no '%t' in the command line?
    (Also take care for 'stderr'. Ignoring that would be practical. '
    Or capture it and show it incase the console program return value is somewhat else than 0)


    Okay to be practical I attached
    • 'pngcheck' it'll show+compare all the data chunks of a *.png
    • PESnoop what is good to compare *.exe; *.dll in the way of listing the PE-Header + dll-Imports and Exports.
    • ... and PE-Dump_MSLinker as alternative that does the same but support as well some rude disassembler and debug+compiler file like *.obj, *.pdb, *.lib etc (however it's a little bit bigger)
    Attached Files Attached Files

  2. #2
    Join Date
    Oct 2007
    Location
    Madison, WI
    Posts
    11,616

    Default

    Thanks for the detailed feedback and example formats. As noted, Beyond Compare's External Conversion command line support expects a "file in" and a "file out" format. The input file is the original file that matched the file format mask, while the output file should be a plain .txt file, temporarily generated by the conversion process, and is what is viewed in the Text Compare. We don't currently support command line programs that take an input file and output to the stdout/console, but as you've found you can write a wrapper or .bat around those conversions to pipe their output to a temporarily .txt file. We can look into adding more support in this area, but for now we would require the wrapper, or the conversion process would need an option to directly output to a file.
    Aaron P Scooter Software

  3. #3
    Join Date
    Oct 2007
    Location
    Madison, WI
    Posts
    11,616

    Default

    Alternatively, you could also get rid of the .cmd wrapper and use an External Conversion like:
    cmd.exe /c "Helpers\png\pngcheck.exe -vv -p -t %s > %t"

    If we were able to implement something, it would be similar to this so there wouldn't be a performance difference between these methods. Given that, this is the method I would recommend.
    Aaron P Scooter Software

  4. #4
    Join Date
    Feb 2013
    Posts
    12

    Default

    Quote Originally Posted by Aaron View Post
    Alternatively, you could also get rid of the .cmd wrapper and use an External Conversion like:
    cmd.exe /c "Helpers\png\pngcheck.exe -vv -p -t %s > %t"
    Cool thanks. (Oh dear I should have thought of this. it's simple like calling 'cmd.exe /c' directly)
    Well forgot to mention this in the inital post but to debug stuff like this
    Code:
    "%~dpn0.exe"  %3 %4 %5 %1 >%2
    it's useful to put echo in front of it
    Code:
    echo "%~dpn0.exe"  %3 %4 %5 %1 >%2
    so you'll see exactly what command BC will run.

    Well getting Consoleoutput works like this (I once did that)
    1.CreatePipe(hReadPipe, hWritePipe
    2. STARTUPINFO.hStdOutput = hWritePipe
    CreateProcess(...

    PeekNamedPipe hReadPipe
    ReadFile(hReadPipe
    3. till Process is finished (GetExitCodeProcess)


    However if you wanna use the more universal and handy 'ShellExecute' that approach won't work since then you can't set 'STARTUPINFO.hStdOutput = hWritePipe' since 'CreateProcess' is done inside the API.


    Maybe just create 2 External Command modules
    • External Programm(Shell) <-current one as it is ( ShellExecute)
    • External Programm(Commandline) - one that is using CreateProcess
      It'll have a inputbox for the actual exe and one for the parameters, and can of course capture stdout

    Why the seperation between Ansi and Unicode FileNames? When I have to use Ansi?(Do we really need that option since doesn't unicode include also ansi.)

  5. #5
    Join Date
    Oct 2007
    Location
    Madison, WI
    Posts
    11,616

    Default

    Hello,

    The ANSI option is the older method for passing information to legacy command line support. We added the Unicode option and generally recommend that. If there's a error code from the conversion, we can pass some up and display certain errors. We wouldn't be able to show the full shell feedback, but the general troubleshooting here is the conversion would hopefully work most of the time. If it fails, we can then drill in and run the conversion from the command line to find the error feedback.
    Aaron P Scooter Software

  6. #6
    Join Date
    Oct 2007
    Location
    Madison, WI
    Posts
    2,505

    Default

    The ANSI version is to support passing Unicode filenames to non-Unicode applications. If the ANSI codepage for the system doesn't support a particular character Windows will convert it to a "?' when it passes it on the command line and it won't be able to open it. BC's internal support will instead convert those filenames to their 8.3 short name equivalents.
    ZoŽ P Scooter Software

  7. #7
    Join Date
    Mar 2013
    Posts
    6

    Default

    Here's one more vote to add variables to the BC4 conversion tab that stand for stdin / stdout respectively.

  8. #8
    Join Date
    Oct 2007
    Location
    Madison, WI
    Posts
    11,616

    Default

    Hello,

    Could you go into more detail on how using the command line example does not meet your needs?

    If we were to implement a variable, it would simplify the interface a bit, but would functionally be similar to the manual process:
    cmd.exe /c "Helpers\png\pngcheck.exe -vv -p -t %s > %t"
    Aaron P Scooter Software

  9. #9
    Join Date
    Mar 2013
    Posts
    6

    Default

    Right, it's "only" syntactic sugar. But to most people it's completely not obvious that you have to wrap everything in "cmd /c" in order to be able to use redirection (">"). That could (and should) be more user friendly, IMO.

  10. #10
    Join Date
    Oct 2007
    Location
    Madison, WI
    Posts
    11,616

    Default

    Hello,

    We do not have any updates at this time, but is something on our wishlist. You would still need to use the above wrapper method to grab this type of input/output.
    Aaron P Scooter Software

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •