Compare files using Beyond Compare -- programmatically

90 views
Skip to first unread message

Jim Nelson

unread,
Oct 22, 2015, 2:11:16 PM10/22/15
to foxpr...@googlegroups.com
Hey, is it possible to fire off a comparison of two text files using Beyond Compare from within FoxPro?  Something like:

Run / n (BeyondCompare)  "filename1" "filename2"

--

Todd Landrum

unread,
Oct 22, 2015, 2:16:17 PM10/22/15
to Thor Google Group

--
You received this message because you are subscribed to the Google Groups "Thor, the Tool Manager for FoxPro" group.
To unsubscribe from this group and stop receiving emails from it, send an email to FoxProThor+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jim Nelson

unread,
Oct 22, 2015, 2:21:00 PM10/22/15
to FoxPr...@googlegroups.com
OK, that was so easy that I am almost (but not quite) embarrassed that I asked:

Run /n "C:\Program Files (x86)\Beyond Compare 4\BCompare.exe" "c:\visual foxpro\programs\9.0\product lifecycle\try2.PRG"  "c:\visual foxpro\programs\9.0\common\try1.PRG"

Gonna incorporate that into a Thor tool for comparing methods.

Andrew Nickless

unread,
Oct 22, 2015, 2:42:21 PM10/22/15
to FoxPr...@googlegroups.com
What about one that can designate the Compare tool rather than 'Beyond Compare'

I use  https://foxcompare.codeplex.com/

To Push into Notepad++  which has a Compare plugin

or

ExamDiff

Jim Nelson

unread,
Oct 22, 2015, 2:45:30 PM10/22/15
to FoxPr...@googlegroups.com
No problem if in invoked with the same syntax as shown below for using BC.

However, the general concept will be easily adaptable, I think.

Fernando D. Bozzo

unread,
Oct 22, 2015, 2:52:00 PM10/22/15
to Thor, the Tool Manager for FoxPro
Hi Jim:

Just in case you are interested in a VFP Diff tool that can be used with almost any generic Diff utility (like Beyond Compare, WinMerge, etc), you can use the one I've incorporated with FoxBin2Prg called fb2p_Diff.exe

http://www.foxite.com/archives/file-compare-0000425730.htm#

This program is an intermediary between Beyond Compare and VFP cpomponents, so anyone can get a quick compare without "Sending To" FoxBin2Prg. It's transparent.

Give it a try a try and let me know if you consider useful to include it in Thor. Main adventage is that it is preconfigured with WinMerge and Beyond Compare setups, and more Diff utilities can be added.

Jim Nelson

unread,
Oct 22, 2015, 3:01:03 PM10/22/15
to FoxPr...@googlegroups.com
Fernando --

I will certainly do so.

I should explain a little of what I want to do.

I find it quite common to want to compare two text windows in FoxPro -- methods from two different forms or classes, for instance.  I don't want to compare the two forms or classes, just a single method.

So what I have always wanted was a way to select one editor window as the left side of the compare and another for the right side, and then be able to just say GO!  All without specifying (or even knowing) file names, with no intent for merging either.

Andrew Nickless

unread,
Oct 22, 2015, 3:06:32 PM10/22/15
to FoxPr...@googlegroups.com
Fernando

Nice! (missed seeing this)

Now I need to look at foxbin2! this looks cool

Fernando D. Bozzo

unread,
Oct 22, 2015, 3:19:20 PM10/22/15
to FoxPr...@googlegroups.com
Hey Andrew, I'm glad you like it :)

I've made it because in the forums many times I've read from people wanting "just a quick compare of VFP files", so I've thought that having the converter this should be only a matter of doing another tool that uses the converter in background, and made fb2p_diff.exe

I don't know if Rick Schummer was aware of this addon when talk about FoxBin2Prg in SouthwestFox last week :p




--
You received this message because you are subscribed to a topic in the Google Groups "Thor, the Tool Manager for FoxPro" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/FoxProThor/ZX01OLOWbU4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to FoxProThor+...@googlegroups.com.

Jim Nelson

unread,
Oct 22, 2015, 3:21:34 PM10/22/15
to FoxPr...@googlegroups.com
Fernando --

He did mention it in his talk. 

However, I will be glad to make it available as a Thor tool.  Is it already available?  How do you start it (you may have explained this in an earlier message)

Fernando D. Bozzo

unread,
Oct 22, 2015, 3:26:44 PM10/22/15
to FoxPr...@googlegroups.com
Ok, I got it! You can't do this "method-only" comparison directly, *but* I think that something can be done, because I think that once FoxBin2Prg makes the whole-file convertion, a subrutine can read the TX2 file and "extract" the method you want

I can't make good tests now on this because I'm temporary living in an Hotel room and I don't have my work PC, just this notebook without all my developer tools, but it is interesting your idea!




--
You received this message because you are subscribed to a topic in the Google Groups "Thor, the Tool Manager for FoxPro" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/FoxProThor/ZX01OLOWbU4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to FoxProThor+...@googlegroups.com.

Jim Nelson

unread,
Oct 22, 2015, 3:30:11 PM10/22/15
to FoxPr...@googlegroups.com
Fernando --

Yes, but no.

I am looking for something this simple:
  1. Click on a code window
  2. Use a hot key to save contents of the code window to a temp file to be used as the left side of a comparison
  3. Click on a different code window
  4. Use the hot key to save the contents of this second window and then immediately invoke a comparison tool between the two temp files.

Fernando D. Bozzo

unread,
Oct 22, 2015, 3:34:36 PM10/22/15
to FoxPr...@googlegroups.com
Hi Jim:

That's awesome! Didn't know that Rick know this new functionality:)

Yes, it is available on VFPx (not in Thor's download yet), in the v1.19.46 Preview link (https://vfpx.codeplex.com/releases/view/116407)
The use is very simple, just double-click fb2p_diff.exe and use the interface for selecting the files.

Jim Nelson

unread,
Oct 22, 2015, 3:40:30 PM10/22/15
to FoxPr...@googlegroups.com
groan.

Sometimes I write too fast and then do not proof-read.

No, sorry, Rick definitely did NOT mention it.  Your message today is the first I had heard of it.

Since I never (OK, hardly ever) use explorer on my foxpro programs, I will invoke it differently.

Koen Piller

unread,
Oct 22, 2015, 4:06:15 PM10/22/15
to FoxPr...@googlegroups.com
Jim
Use frx2bin this will make a fine textfile. Bevond 2 Compare Does not work with vcx or scx / vct or sct files.
Koen
--
You received this message because you are subscribed to the Google Groups "Thor, the Tool Manager for FoxPro" group.
To unsubscribe from this group and stop receiving emails from it, send an email to FoxProThor+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
Verzonden vanaf mijn iPhone

Jim Nelson

unread,
Oct 22, 2015, 4:09:15 PM10/22/15
to FoxPr...@googlegroups.com
Koen --

There is a plug-in for Beyond Compare (from Frank Perez, Jr.)  that does a great job of comparing binary files.  I have been using it for years.

From my later messages, you'll see that I am not at all interested in comparing binary files, but rather method code from open code windows.

Mike Potjer

unread,
Oct 23, 2015, 12:46:03 PM10/23/15
to Thor, the Tool Manager for FoxPro
Jim,

Here's another thought.  Instead of having to select a window, press a hotkey, and select another window, what if such a tool got a list of the open code windows.  If there are only two code windows open, the tool could just do the compare on both of them, without having to select anything.  If there are more than 2 windows open, you could prompt the developer in some way to select which ones to compare - maybe with a grid with checkboxes to select the code windows.  Since VFPX tools like FoxTabs and TabbingNavigation can track all the open windows, it shouldn't be too hard get that list.


On Thursday, October 22, 2015 at 4:09:15 PM UTC-4, Jim wrote:
Koen --

There is a plug-in for Beyond Compare (from Frank Perez, Jr.)  that does a great job of comparing binary files.  I have been using it for years.

From my later messages, you'll see that I am not at all interested in comparing binary files, but rather method code from open code windows.
On Thu, Oct 22, 2015 at 2:06 PM, Koen Piller <koen....@gmail.com> wrote:
Jim
Use frx2bin this will make a fine textfile. Bevond 2 Compare Does not work with vcx or scx / vct or sct files.
Koen

Op donderdag 22 oktober 2015 heeft Jim Nelson <jimrn...@gmail.com> het volgende geschreven:
Hey, is it possible to fire off a comparison of two text files using Beyond Compare from within FoxPro?  Something like:

Run / n (BeyondCompare)  "filename1" "filename2"

--

--
You received this message because you are subscribed to the Google Groups "Thor, the Tool Manager for FoxPro" group.
To unsubscribe from this group and stop receiving emails from it, send an email to FoxProThor+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.


--
Verzonden vanaf mijn iPhone

--
You received this message because you are subscribed to the Google Groups "Thor, the Tool Manager for FoxPro" group.
To unsubscribe from this group and stop receiving emails from it, send an email to FoxProThor+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jim

unread,
Oct 23, 2015, 1:14:16 PM10/23/15
to FoxPr...@googlegroups.com
Good idea, Mike, but a little bit late as it turns out that I've already implemented the suggestion that I made yesterday.

It's really a question of how you want to be able to select more than anything else and I think what I've done is reasonable enough. Selecting from a list of open windows might be problematic in that some of the windows may have the same title (such as "Refresh") which would make selection complicated. 

Another suggestion which might make sense would be to compare the two most recently visited editor windows. 

In any case when I make this tool available we can just use it as a starting point and see if any further enhancements would make it easier to use. 


Sent from my iPhone

Mike Potjer

unread,
Oct 23, 2015, 1:51:34 PM10/23/15
to Thor, the Tool Manager for FoxPro
Oh well, maybe in a future version then.  I think the main thing will be if the tool provides some means of configuring the compare tool to use, as has already been suggested.  Since there are a number of good, free compare tools, I never felt the need to spend the money to purchase Beyond Compare.

Jim Nelson

unread,
Oct 23, 2015, 3:17:40 PM10/23/15
to foxpr...@googlegroups.com
Mike --

There are two part to this.

The tool itself selects which two windows to compare.  It is a good example of how to use some Thor utilities to achieve the result in just a few lines.

The second part is done thru a plug-in, which you can customize to use your own comparison tool.

I have used Beyond Compare for many years. Once the plug-in from Frank Perez, Jr is installed, it can be used to compare entire folders, including binaries, at a glance.  I have not heard of this feature from any other comparison tools.

I hope to have the tool out the door in a few days. For those of you who use Beyond Compare, here are the links to Frank's plug-in (almost to be made available as Thor tools)





Jim,

Reply all
Reply to author
Forward
0 new messages