View previous topic :: View next topic |
Author |
Message |
moke Contributor
Joined: 02 Jan 2002 Posts: 162
|
Posted: Tue Apr 01, 2003 5:40 pm Post subject: File Comparison |
|
|
Ok this is kinda cheating but I had to do something. I use FC all the time but it's a pain to use it as a DOS utility , even though I still use many DOS commands .
So I played around and came up with this:
Added binary support - Thanks Mac
Code: |
Rem very simple file comparison using DOS FC.exe
Rem using %1 & %2 you can put a short cut in your sendto menu.
option scale, 96
Title File compare
DIALOG CREATE,File Compare,-10,-10,390,367
DIALOG ADD,STYLE,STYLE1,,8,BC,BACKGROUND,DKBLUE
DIALOG ADD,EDIT,File1,21,4,296,16,%1
DIALOG ADD,EDIT,File2,68,4,296,16,%2
DIALOG ADD,BUTTON,selfile1,16,310,68,24,Select file #1
DIALOG ADD,BUTTON,selfile2,65,310,68,24,Select file #2
DIALOG ADD,TEXT,TEXT1,8,1,,,,style1
DIALOG ADD,BUTTON,compare,97,118,64,24,Compare
DIALOG ADD,TEXT,TEXT2,6,4,,,File #1
DIALOG ADD,TEXT,TEXT3,54,4,,,File #2
DIALOG ADD,BUTTON,quit,97,235,64,24,Quit
DIALOG ADD,LIST,LIST1,144,8,370,202
DIALOG ADD,TEXT,TEXT4,126,8,,,Results:
DIALOG ADD,CHECK,CHECK1,97,8,92,21,Binary mode
DIALOG SHOW
%z = @sendmsg(@winexists(~List1),$0194,2000,0)
If %3
warn You can only select 2 files at a time!@cr()@cr()File compare will now compare your@cr()first 2 selections.
end
:evloop
wait event
goto @event()
:selfile1button
%1 = @filedlg("Text File(*.txt)|*.txt|All files(*.*)|*.*",Select first file to compare,@path(%1)FileComp.txt,)
Dialog set, file1,%1
goto evloop
:selfile2button
%2 = @filedlg("Text File(*.txt)|*.txt|All files(*.*)|*.*",Select second file to compare,@path(%1)FileComp.txt,)
Dialog set, file2,%2
goto evloop
:comparebutton
If @not(%1)@not(%2)
warn You must select 2 files before comparing!
goto evloop
end
IF @DLGTEXT(CHECK1)
%b = "/b"
end
rem use this "%%file = @filedlg("Text File(*.txt)|*.txt",Enter file name to save,@path(%1)FileComp.txt,Save)" or ... This:
%%file = @filedlg("Text File(*.txt)|*.txt",Enter file name to save,@path(%1)FileComp.txt,Save)
rem %%file = @env(temp)\filecompare.txt
Rem for some reason "Run FC @chr(34)%1@chr(34) @chr(34)%2@chr(34) > @chr(34)%%file@chr(34)" is not working
Rem nor is Shell, it won't take the "> %%file". Am I brain dead today?
runh cmd /c fc @chr(34)%1@chr(34) @chr(34)%2@chr(34) > @chr(34)%%file@chr(34) %b,wait
rem use this "run @chr(34)%%file@chr(34)" or... this:
run @chr(34)%%file@chr(34)
rem list loadfile,list1,%%file
goto evloop
:quitbutton
:Close
:exit
exit
|
moke
Last edited by moke on Wed Apr 02, 2003 2:01 pm; edited 4 times in total |
|
Back to top |
|
|
Mac Professional Member
Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Tue Apr 01, 2003 9:08 pm Post subject: |
|
|
I think it's a good idea moke - here's one I've been using a
while - does both TEXT and BINARY compare:
_______________________________________________________________________________________________________________________________________________________________________________________
Code: |
rem -- VDS3 and VDS4 compatible --
rem -- DOS FC (file compare) program --
OPTION SCALE, 96
OPTION DECIMALSEP, "."
TITLE By Mac
DIALOG CREATE,"DOS File Compare",-1,0,300,260
DIALOG ADD,STYLE,S1,MS Sans Serif,8,B
DIALOG ADD,STYLE,S2,Courier New,10
DIALOG ADD,BUTTON,LoadFile1,5,5,50,20,"File 1",,S1
DIALOG ADD,BUTTON,LoadFile2,5,60,50,20,"File 2",,S1
DIALOG ADD,CHECK,CK1,6,115,,,"Binary"
DIALOG ADD,BUTTON,Compare,5,168,65,20,,,S1
DIALOG ADD,BUTTON,Save,5,238,58,20,,,S1
DIALOG ADD,LIST,L1,30,5,290,165,,S2,DBLCLICK
DIALOG ADD,EDIT,E1,200,0,300,20,"Select File 1, or type it here...",S1
DIALOG ADD,EDIT,E2,220,0,300,20,"Select File 2, or type it here...",S1
DIALOG ADD,STATUS,Stat,"Ready...",S1
DIALOG SHOW
rem -- Add horizontal scroll to list --
%z = @sendmsg(@winexists(~L1),$0194,2000,0)
:EVLOOP
DIALOG SET, Stat, @count(L1) items - Doubleclick copies to clipboard...
WAIT EVENT
goto @event()
:L1DBLCLICK
CLIPBOARD SET, @item(L1)
INFO "Item copied to clipboard..."@tab()
goto EVLOOP
:LoadFile1BUTTON
%%f1 = @filedlg()
if %%f1
DIALOG SET, E1, %%f1
end
goto EVLOOP
:LoadFile2BUTTON
%%f2 = @filedlg()
if %%f2
DIALOG SET, E2, %%f2
end
goto EVLOOP
:CompareBUTTON
LIST CLEAR, L1
if @dlgtext(CK1)
%b = "/b"
DIALOG SET, Stat, "Comparing files (binary)..."
else
%b = ""
DIALOG SET, Stat, "Comparing files..."
end
if @both(@file(@dlgtext(E1)), @file(@dlgtext(E2)))
%%f1 = @dlgtext(E1)
%%f2 = @dlgtext(E2)
else
if @file(@dlgtext(E1))
WARN This is not a valid file:@cr()@cr()@chr(34)@dlgtext(E2)@chr(34)@tab()
else
WARN This is not a valid file:@cr()@cr()@chr(34)@dlgtext(E1)@chr(34)@tab()
end
goto EVLOOP
end
RUNZ command /c fc @shortname(%%f1) @shortname(%%f2) %b > c:\zzzzfile.dat, WAIT
if @file(c:\zzzzfile.dat)
if %b
if @greater(@file(c:\zzzzfile.dat, Z), 550000)
INFO "Files are too different for this program,"@tab()@cr()use DOS @chr(34)fc /b@chr(34) at command prompt.@cr()@cr()File size: @file(c:\zzzzfile.dat, Z) bytes...
else
LIST LOADFILE, L1, c:\zzzzfile.dat
end
else
LIST LOADFILE, L1, c:\zzzzfile.dat
end
else
WARN "Cannot find output file: "@tab()@cr()@cr()@chr(34)c:\zzzzfile.dat@chr(34)
end
WAIT
if @file(c:\zzzzfile.dat)
FILE DELETE, c:\zzzzfile.dat
end
goto EVLOOP
:SaveBUTTON
if @greater(1, @count(L1))
WARN "Nothing to save..."@tab()
goto EVLOOP
end
%f = @filedlg(,,,SAVE)
if %f
if @file(%f)
if @ask("File already exists. Overwrite it?"@tab())
LIST SAVEFILE, L1, %f
end
else
LIST SAVEFILE, L1, %f
end
end
goto EVLOOP
:CLOSE
if @file(c:\zzzzfile.dat)
FILE DELETE, c:\zzzzfile.dat
end
EXIT
|
Cheers, Mac _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
Last edited by Mac on Tue Apr 01, 2003 9:16 pm; edited 1 time in total |
|
Back to top |
|
|
Mac Professional Member
Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Tue Apr 01, 2003 9:19 pm Post subject: |
|
|
BTW moke, yours seems to be missing a CLOSE label. _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
|
|
Back to top |
|
|
moke Contributor
Joined: 02 Jan 2002 Posts: 162
|
Posted: Tue Apr 01, 2003 9:27 pm Post subject: |
|
|
Pretty neat Mac , I didn't bother with the binary switch because I don't
use it much. But I did want to use the %1, %2 so I could put it a shortcut
in the sendto menu. Then I could just select the files, right click them
and "sendto" file compare. You can also see remmed out I had it opening
in notepad so I didn't have to bother with using a list and print it easier.
moke
Last edited by moke on Tue Apr 01, 2003 9:32 pm; edited 1 time in total |
|
Back to top |
|
|
moke Contributor
Joined: 02 Jan 2002 Posts: 162
|
Posted: Tue Apr 01, 2003 9:29 pm Post subject: |
|
|
Thanks for the close comment Mac. That's what I get for doing it over breakfast. |
|
Back to top |
|
|
Mac Professional Member
Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Tue Apr 01, 2003 9:50 pm Post subject: |
|
|
Hey moke,
DOS FC TEXT compare is what I used when I first wrote the
VDSUG.DLL. It didn't pick up the difference on the missing
carriage returns, even though there were a couple hundred
bytes difference in file size of the ones I tested (found this
out later).
I'll prolly never do a TEXT ONLY compare again - something
ya might consider.
Cheers, Mac _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
|
|
Back to top |
|
|
moke Contributor
Joined: 02 Jan 2002 Posts: 162
|
Posted: Tue Apr 01, 2003 10:08 pm Post subject: |
|
|
Ya know... I can see myself now wonderin' what the $%^$% is wrong
with my comparison ...
I think I'll take oyur advice.
moke |
|
Back to top |
|
|
Mac Professional Member
Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Tue Apr 01, 2003 10:32 pm Post subject: |
|
|
Just to be clear (hopefully) - didn't mean I'll never do a TEXT
compare, but prolly won't do many without following up with
a binary compare as well.
Cheers, Mac _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
|
|
Back to top |
|
|
moke Contributor
Joined: 02 Jan 2002 Posts: 162
|
Posted: Wed Apr 02, 2003 2:33 am Post subject: |
|
|
I knew what you meant as you can see in the revised code.
moke |
|
Back to top |
|
|
Mac Professional Member
Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Wed Apr 02, 2003 2:40 am Post subject: |
|
|
Might wanna re-copy the whole program moke....
This code:
Code: |
IF @DLGTEXT(CHECK1)
%b = "/b"
end
|
references an element that doesn't exist...
Cheers, Mac _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
|
|
Back to top |
|
|
moke Contributor
Joined: 02 Jan 2002 Posts: 162
|
Posted: Wed Apr 02, 2003 2:56 am Post subject: |
|
|
I'll have to get it in the AM when I get to another PC. I'm just to
lazy tonight and my guitar is beggin t be played .
moke |
|
Back to top |
|
|
Mac Professional Member
Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Wed Apr 02, 2003 3:11 am Post subject: |
|
|
Really? Have an old Gibson SG myself.... _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
|
|
Back to top |
|
|
SnarlingSheep Professional Member
Joined: 13 Mar 2001 Posts: 759 Location: Michigan
|
|
Back to top |
|
|
moke Contributor
Joined: 02 Jan 2002 Posts: 162
|
Posted: Wed Apr 02, 2003 3:29 am Post subject: |
|
|
Yeah, got a '73 Fender Tele Delux w/ 2 split humbuckers and alot of
twang fun to play Blues with |
|
Back to top |
|
|
Dr. Dread Professional Member
Joined: 03 Aug 2001 Posts: 1065 Location: Copenhagen, Denmark
|
Posted: Wed Apr 02, 2003 6:35 am Post subject: |
|
|
A picture just popped up in my mind - I see Mac, the hillbilly, sitting around playing his
guitar right out of the Deliverance imagery.
This might be Mac a few years back when he still had his banjo:
Dread
PS: Going a bit off topic now. Not my fault - you started that, guys... _________________ ~~ Alcohol and calculus don't mix... Don't drink and derive! ~~
String.DLL * advanced string processing |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|