cancel
Showing results for 
Search instead for 
Did you mean: 

How to call Beyond Compare from script to compare PDF files

tlalok
Contributor

How to call Beyond Compare from script to compare PDF files

Hi,



I have a test that has to compare pdf files. After some playing with "File Checkpoint" I came to the conclusion, that the PDFs are never binary the same so the "File Checkpoint" will always fail.



I also checked FAQ: Q.:
Can I use TestComplete to compare PDF files?


(http://www.automatedqa.com/support/viewarticle.aspx?aid=8859&hlite=pdf;compare).

However, the answer does not really help me.



Then I ran over beyond compare and found out that it supports a "rule based" comparison that ignores byte differences but checks if the content is the same. In the gui, I could successfully compare my pdfs as "rule based equal".



So, now my question for TestComplete:



I created a script function  that uses Win32API.WinExec( "[... whole command line]") and it seems to be doing something, but WinExec does not return the result from beyond compare (I expect "3"), but something bigger than 32.



So, how can I call an external process from script and do something with the exist code the process returns?



I'm working with Delphi Script.



Thanks for any help on this.



Regards,



-Carsten
1 REPLY 1
tlalok
Contributor

RE: How to call Beyond Compare from script to compare PDF files

Hi,



I spend some more time searching the newsgroup and found a code snippet that helped me do this:



  aCmdLine := 'BComp.com Baseline.pdf Verifiy.pdf /quickcompare';

  aResult := Sys.OleObject('WScript.Shell').Run( aCmdLine, 1, TRUE);



Looks like I'm using the Windows Scripting Host now. I don't know much about it, but now I get my expected result "2" in aResult.



Great!



Regards,

-Carsten
New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors