home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DP Tool Club 25
/
CD_ASCQ_25_1095.iso
/
dos
/
tools
/
auror21a
/
compare.aml
< prev
next >
Wrap
Text File
|
1995-08-31
|
3KB
|
117 lines
/* ------------------------------------------------------------------ */
/* Macro: COMPARE.AML */
/* Written by: nuText Systems */
/* */
/* Description: This macro compares two files, with various options. */
/* */
/* Usage: Select this macro from the Macro List (on the Macro */
/* menu), or run it from the macro picklist <shift f12> */
/* ------------------------------------------------------------------ */
include bootpath "define.aml"
var file2
var options
// set default filenames
file1 = getbufname
file2 = if _BackupDir then
qualify (getname file1) (qualify _BackupDir)
else
forceext file1 _BackupExt
end
// compare dialog box
dialog "Compare Files" 65 10 "c"
field "&Compare: >" 3 2 40 file1 "_load"
field "&With: >" 3 4 40 file2 "_load"
// initialize to previous options, if possible
options = if lookup "cmpopt" 'prf' 'e' then
lookup "cmpopt" 'prf'
else
"lo"
end
// compare options group box
groupbox '' 3 6
(menu ''
item " [ ] Show &Line Numbers"
item " [ ] &Ignore Case"
item " [ ] Show &First and Last Lines Only "
item " [ ] Use &Open Files if Possible"
end) '' options "lifo"
// ok/cancel buttons
button "O&k" 55 2 8
button "Cancel" 55 4 8
// display dialog box and get control values
if (getdialog ref file1 ref file2 ref options) == 'Ok' then
// save options for next time
setobj cmpopt options 'prf'
oldbuf = getcurrbuf
// use open files
if pos 'o' options then
// file 1
buffer = findbuf file1
if buffer then
oldfile1 = file1
file1 = (getpath file1) + "@@@@CMP1"
gotobuf buffer
ok = save file1
gotobuf oldbuf
if not ok then
msgbox "Save Error!"
return
end
end
// file 2
buffer = findbuf file2
if buffer then
oldfile2 = file2
file2 = (getpath file2) + "@@@@CMP2"
gotobuf buffer
ok = save file2
gotobuf oldbuf
if not ok then
msgbox "Save Error!"
return
end
end
end
// run the DOS 'FC' command and capture the output
runcap "fc " + file1 + ' ' + file2 +
(if? (pos 'l' options) ' /n') +
(if? (pos 'f' options) ' /a') +
(if? (pos 'i' options) ' /c')
if getcurrbuf <> oldbuf then
// change temporary filenames back to actual filenames in
// the comparison report
if oldfile1 then
replace file1 oldfile1 '*ag'
end
if oldfile2 then
replace file1 oldfile2 '*ag'
end
// turn off the buffer modified flag
bufferflag '-m'
end
// cleanup temporary files
if oldfile1 then
deletefile file1
end
if oldfile2 then
deletefile file2
end
end