pdf text compare on cmd line returns 13, even with Grammar exclusion

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Teletraan I
    Visitor
    • Oct 2016
    • 3

    pdf text compare on cmd line returns 13, even with Grammar exclusion

    We are using BC on the cmd line to compare 2 pdf files and return match or not matched. There are date fields in the pdf which we have successfully used Importance - Grammar to exclude within the GUI. There we are able to see the mismatched text turn blue denoting the mismatches that are ok. We did get this to work ok with docx files on the cmd line, but now with similar steps to exclude mismatched dates with our pdf files, the cmd code below is returning Error Code = 13 (Rules Based Differences).

    I am guessing that the imported bcpkg settings are not being ignored, but I have tried to comment the load out and set it up manually in the GUI, but on the cmd its still returning Error=13. Its odd that it works fine for us with docx files but we have issues with our pdf files. The only difference is that there is only 1 exception with the docx and there are 3 exceptions with the pdf (due to the text spanning multiple lines).

    Thoughts on how to programmatically ensure the cmd compare returns a "Match" after excluding our exceptions?


    Code:
    @echo off
    
    set file1=%1
    set file2=%2
    
    if not exist "C:\Program Files\Beyond Compare 4\bcomp.com" goto error
    
    "C:\Program Files\Beyond Compare 4\bcompare" "Z:\Automation_Tools\Beyond Compare\PolicyGenDate_pdf.bcpkg" /silent
    
    echo %ERRORLEVEL%
    echo Imported bcpkg
    
    "C:\Program Files\Beyond Compare 4\bcomp.com" /qc %file1% %file2%
    
    echo %ERRORLEVEL%
  • Aaron
    Team Scooter
    • Oct 2007
    • 15997

    #2
    Hello,

    From the script, if you remove "/qc" and launch the graphical interface, does this show the diff as you expect? Does it show any differences? Are the grammar elements marked as Unimportant by default?
    Aaron P Scooter Software

    Comment

    • Teletraan I
      Visitor
      • Oct 2016
      • 3

      #3
      How to Programmatically uncheck (deselect) the grammar exceptions

      It displays and works properly in the GUI, after I deselected the grammar elements that I want it to ignore, and selected "Also update session defaults" and save that on the GUI. Then I can run from the cmd line and it works as expected.

      The issue I continue to have is that I want to import specific grammar items via the cmd line that I want to ignore. I know that I can do the import with the line:

      Code:
      "C:\Program Files\Beyond Compare 4\bcompare" "Z:\Automation_Tools\Beyond Compare\PolicyGenDate_pdf.bcpkg" /silent
      But importing the grammar items only loads them. I then need to programmatically uncheck (deselect) the grammar exceptions (to allow Beyond Compare to ignore them). How do I deselect these via cmd line after importing the file?

      Thank you in advance!

      Comment

      • Aaron
        Team Scooter
        • Oct 2007
        • 15997

        #4
        Hello,

        The bcpkg needs to have the global defaults set to have that grammar as Unimportant, and then export to create the .bcpkg file.

        Importing the bcpkg with the Text Compare default set and the grammar element in the File Format, does this help get you up and running?
        Aaron P Scooter Software

        Comment

        • Teletraan I
          Visitor
          • Oct 2016
          • 3

          #5
          It looks like I have to have multiple bcpkg files and import them individually, rather than import 1 and turn on/off the individual exceptions. This is a bit slower and more configuration, but is doable.

          Thanks

          Comment

          • Aaron
            Team Scooter
            • Oct 2007
            • 15997

            #6
            Hello,

            You shouldn't need multiple bcpkg files. Configure the graphical interface Text Compare session defaults and the additional File Format grammar. The exported bcpkg needs to include both Sessions -> Text Compare default and File Formats -> your custom Format with grammar included.

            You can then test an import graphically to note that in a clean, portable install it brings in both the Text defaults and Format, and open a file to note it defaults to Unimportant (without needing any user input). Scripting with this bcpkg should then work, too.
            Aaron P Scooter Software

            Comment

            Working...