Beyond Compare: Difference between revisions

From Pickwiki
Jump to navigationJump to search
Stuboy (talk | contribs)
mNo edit summary
 
m link fix
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
= Beyond Compare UV Dictionary formatter =
http://farm5.static.flickr.com/4024/4663375640_cb1cf442ba.jpg
*Works with Beyond Compare - allows you to compare most UV dictionary items.
*Written in Javascript.
*Save this to c:\program files\Beyond Compare 3\helpers\<nowiki>UVDictCompare.js</nowiki>
*Setup a new <nowiki>Tools/File</nowiki> Format for UV Dictionaries.
:: Under the Conversion tab - conversion drop down select: External Program
:: Loading: cscript helpers\<nowiki>UVDictCompare.js</nowiki> %s %t %n
http://farm2.static.flickr.com/1269/4665084040_6bf2fd0799.jpg
<pre>
// BC-UVDict Compare
// This script formats a UV dictionary item for compare.
// It is then opened with Beyond Compare (File Formats, Conversion)
// Stuart Boydell 31-Oct-2009
// 1. The dictionary items to compare are stored in a type19 file in UV
//    - I-types should have attribute 10 and up deleted to remove compiled binary 'stuff'.
//    - Expects type 19 record to be in the following format:
//      hostName:@vm:dictPath:@am:dictName:@am:dictId:@am:field(dict<1>,' ',1):@am:system(99):@am:system(19):@am:lower(dictRecord)
// 2. items opened using Beyond Compare - it 'senses' the file type
// 3. BC invokes this script passing in source & target tmp file specs
// 4. this script writes the modified version of the dict to the target file
// 5. BC then compares these files.
// 6. <<todo>> writeback
var of, oa, fs, ft, i, j, z, zz;
var _vm = String.from[[CharCode]](253)
of = new [[ActiveXObject]]('Scripting.[[FileSystemObject]]');
oa = WScript.Arguments;
// take the source & target arguments from BC
fs = of.[[OpenTextFile]](oa(0),1,false);
ft = of.[[OpenTextFile]](oa(1),2,false);
// Read the dict item then pull att 7
z = fs.[[ReadAll]]();
zz = z.split('\n')[6].split(_vm);
//ft.[[WriteLine]]('File Path:' + oa(2).substr(0,oa(2).indexOf('//',10)));
ft.[[WriteLine]]('File Path:' + z.split('\n')[0].split(_vm)[1]);
ft.[[WriteLine]]('Dict Id  :' + z.split('\n')[2]);
ft.[[WriteLine]]('---');
ft.Write(zz.join('\r\n'));
fs.Close
ft.Close
</pre>
= Beyond Compare SB+ Paragraph formatter =
= Beyond Compare SB+ Paragraph formatter =
*Works with Beyond Compare - allows you to compare SB+ Paragraph Processes.
*Works with Beyond Compare - allows you to compare SB+ Paragraph Processes.
Line 15: Line 70:
// Stuart Boydell 21-Dec-2009
// Stuart Boydell 21-Dec-2009


// 0. setup a new Tools/File Format for SB Paragraphs. Loading: cscript SBParaCompare.js %s %t %n
// 0. setup a new Tools[[/File]] Format for SB Paragraphs. Loading: cscript [[SBParaCompare]].js %s %t %n
// 1. The paragraph items to compare are stored in a type19 file in U2
// 1. The paragraph items to compare are stored in a type19 file in U2
// 2. items are opened using Beyond Compare - it normally 'senses' the file type - but you can use the format drop down to force it.
// 2. items are opened using Beyond Compare - it normally 'senses' the file type - but you can use the format drop down to force it.
Line 23: Line 78:


var of, oa, fs, ft, i, j, z, zz, re, lsep, ftyp;
var of, oa, fs, ft, i, j, z, zz, re, lsep, ftyp;
var _vm = String.fromCharCode(253);
var _vm = String.from[[CharCode]](253);
re = /\r\n/; // test for windows type newline
re = /\r\n/; // test for windows type newline


of = new ActiveXObject('Scripting.FileSystemObject');
of = new [[ActiveXObject]]('Scripting.[[FileSystemObject]]');
oa = WScript.Arguments;
oa = WScript.Arguments;


// take the source & target arguments from BC
// take the source & target arguments from BC
fs = of.OpenTextFile(oa(0),1,false);
fs = of.[[OpenTextFile]](oa(0),1,false);
ft = of.OpenTextFile(oa(1),2,false);
ft = of.[[OpenTextFile]](oa(1),2,false);
fo = of.OpenTextFile(oa(2),1,false);
fo = of.[[OpenTextFile]](oa(2),1,false);


// Read the process item then pull att 6
// Read the process item then pull att 6
z  = fs.ReadAll();
z  = fs.[[ReadAll]]();
if (re.test(z)){
if (re.test(z)){
   lsep = "\r\n";
   lsep = "\r\n";
Line 44: Line 99:
}
}
zz = z.split(lsep);
zz = z.split(lsep);
//ft.WriteLine('File Path:' + oa(2).substr(0,oa(2).indexOf('//',10)));
//ft.[[WriteLine]]('File Path:' + oa(2).substr(0,oa(2).indexOf('//',10)));
ft.WriteLine('Desc:' + zz[1]);
ft.[[WriteLine]]('Desc:' + zz[1]);
ft.WriteLine('Dict:' + zz[4]);
ft.[[WriteLine]]('Dict:' + zz[4]);
ft.WriteLine('LastUpd:' + zz[13]);
ft.[[WriteLine]]('[[LastUpd]]:' + zz[13]);
//ft.WriteLine('F-type:' + ftyp);
//ft.[[WriteLine]]('F-type:' + ftyp);
ft.WriteLine('---');
ft.[[WriteLine]]('---');
ft.Write(zz[5].split(_vm).join(lsep));
ft.Write(zz[5].split(_vm).join(lsep));


Line 73: Line 128:


var of, oa, fs, ft, i, j, z, zz, lsep, re;
var of, oa, fs, ft, i, j, z, zz, lsep, re;
var _vm = String.fromCharCode(253);
var _vm = String.from[[CharCode]](253);
re = /\r\n/; // test for windows type newline
re = /\r\n/; // test for windows type newline


of = new ActiveXObject('Scripting.FileSystemObject');
of = new [[ActiveXObject]]('Scripting.[[FileSystemObject]]');
oa = WScript.Arguments;
oa = WScript.Arguments;


// take the source & target arguments from BC
// take the source & target arguments from BC
fs = of.OpenTextFile(oa(0),1,false);
fs = of.[[OpenTextFile]](oa(0),1,false);
ft = of.OpenTextFile(oa(1),2,false);
ft = of.[[OpenTextFile]](oa(1),2,false);
fo = of.OpenTextFile(oa(2),1,false);
fo = of.[[OpenTextFile]](oa(2),1,false);


// Read the process item then pull att 6
// Read the process item then pull att 6
z  = fo.ReadAll();
z  = fo.[[ReadAll]]();
if (re.test(z)){
if (re.test(z)){
   lsep = "\r\n";
   lsep = "\r\n";
Line 94: Line 149:
}
}
tt = z.split(lsep);
tt = z.split(lsep);
zz = fs.ReadAll().split(lsep);
zz = fs.[[ReadAll]]().split(lsep);
tt[1] = zz[0].split(':')[1];
tt[1] = zz[0].split(':')[1];
tt[2] = '';
tt[2] = '';

Latest revision as of 23:48, 26 February 2015

Beyond Compare UV Dictionary formatter

http://farm5.static.flickr.com/4024/4663375640_cb1cf442ba.jpg

  • Works with Beyond Compare - allows you to compare most UV dictionary items.
  • Written in Javascript.
  • Save this to c:\program files\Beyond Compare 3\helpers\UVDictCompare.js
  • Setup a new Tools/File Format for UV Dictionaries.
Under the Conversion tab - conversion drop down select: External Program
Loading: cscript helpers\UVDictCompare.js %s %t %n

http://farm2.static.flickr.com/1269/4665084040_6bf2fd0799.jpg

// BC-UVDict Compare
// This script formats a UV dictionary item for compare.
// It is then opened with Beyond Compare (File Formats, Conversion)

// Stuart Boydell 31-Oct-2009

// 1. The dictionary items to compare are stored in a type19 file in UV
//    - I-types should have attribute 10 and up deleted to remove compiled binary 'stuff'.
//    - Expects type 19 record to be in the following format:
//      hostName:@vm:dictPath:@am:dictName:@am:dictId:@am:field(dict<1>,' ',1):@am:system(99):@am:system(19):@am:lower(dictRecord)
// 2. items opened using Beyond Compare - it 'senses' the file type
// 3. BC invokes this script passing in source & target tmp file specs
// 4. this script writes the modified version of the dict to the target file
// 5. BC then compares these files.
// 6. <<todo>> writeback

var of, oa, fs, ft, i, j, z, zz;
var _vm = String.from[[CharCode]](253)

of = new [[ActiveXObject]]('Scripting.[[FileSystemObject]]');
oa = WScript.Arguments;

// take the source & target arguments from BC
fs = of.[[OpenTextFile]](oa(0),1,false);
ft = of.[[OpenTextFile]](oa(1),2,false);

// Read the dict item then pull att 7
z = fs.[[ReadAll]]();
zz = z.split('\n')[6].split(_vm);
//ft.[[WriteLine]]('File Path:' + oa(2).substr(0,oa(2).indexOf('//',10)));
ft.[[WriteLine]]('File Path:' + z.split('\n')[0].split(_vm)[1]);
ft.[[WriteLine]]('Dict Id  :' + z.split('\n')[2]);
ft.[[WriteLine]]('---');
ft.Write(zz.join('\r\n'));

fs.Close
ft.Close


Beyond Compare SB+ Paragraph formatter

  • Works with Beyond Compare - allows you to compare SB+ Paragraph Processes.
  • Written in Javascript.
  • Save this to c:\program files\Beyond Compare 3\helpers\SBParaCompare.js
  • Setup a new Tools/File Format for SB Paragraphs.
Under the Conversion tab - conversion drop down select: External Program
Loading: cscript helpers\SBParaCompare.js %s %t %n


// BC-SB Paragraph Compare
// This scripts uses the output from a type 19 process file
// it is then used with Beyond Compare (File Formats, Conversion)

// Stuart Boydell 21-Dec-2009

// 0. setup a new Tools[[/File]] Format for SB Paragraphs. Loading: cscript [[SBParaCompare]].js %s %t %n
// 1. The paragraph items to compare are stored in a type19 file in U2
// 2. items are opened using Beyond Compare - it normally 'senses' the file type - but you can use the format drop down to force it.
// 3. BC invokes this script passing in source & target tmp file specs
// 4. this script writes the modified version of the process to the target file
// 5. BC then compares these files.

var of, oa, fs, ft, i, j, z, zz, re, lsep, ftyp;
var _vm = String.from[[CharCode]](253);
re = /\r\n/;	// test for windows type newline

of = new [[ActiveXObject]]('Scripting.[[FileSystemObject]]');
oa = WScript.Arguments;

// take the source & target arguments from BC
fs = of.[[OpenTextFile]](oa(0),1,false);
ft = of.[[OpenTextFile]](oa(1),2,false);
fo = of.[[OpenTextFile]](oa(2),1,false);

// Read the process item then pull att 6
z  = fs.[[ReadAll]]();
if (re.test(z)){
   lsep = "\r\n";
   ftyp = "Win";
} else {
   lsep = "\n";
   ftyp = "Unix";
}
zz = z.split(lsep);
//ft.[[WriteLine]]('File Path:' + oa(2).substr(0,oa(2).indexOf('//',10)));
ft.[[WriteLine]]('Desc:' + zz[1]);
ft.[[WriteLine]]('Dict:' + zz[4]);
ft.[[WriteLine]]('[[LastUpd]]:' + zz[13]);
//ft.[[WriteLine]]('F-type:' + ftyp);
ft.[[WriteLine]]('---');
ft.Write(zz[5].split(_vm).join(lsep));

fs.Close
ft.Close

Beyond Compare SB+ Paragraph Write back Script

  • Works with Beyond Compare - allows you to write back edits.
  • Written in Javascript.
  • Save this to c:\program files\Beyond Compare 3\helpers\SBParaWriteback.js
Under the Conversion tab - disable editing <off>
Saving: cscript helpers\SBParaWriteback.js %s %t %n


// BC-SB Paragraph Compare - Write back
// This writes back to a type 19 process file
// it is then used with Beyond Compare (File Formats, Conversion)

// Stuart Boydell 21-Dec-2009

var of, oa, fs, ft, i, j, z, zz, lsep, re;
var _vm = String.from[[CharCode]](253);
re = /\r\n/;	// test for windows type newline

of = new [[ActiveXObject]]('Scripting.[[FileSystemObject]]');
oa = WScript.Arguments;

// take the source & target arguments from BC
fs = of.[[OpenTextFile]](oa(0),1,false);
ft = of.[[OpenTextFile]](oa(1),2,false);
fo = of.[[OpenTextFile]](oa(2),1,false);

// Read the process item then pull att 6
z  = fo.[[ReadAll]]();
if (re.test(z)){
   lsep = "\r\n";
   ftyp = "Win";
} else {
   lsep = "\n";
   ftyp = "Unix";
}
tt = z.split(lsep);
zz = fs.[[ReadAll]]().split(lsep);
tt[1] = zz[0].split(':')[1];
tt[2] = '';
tt[3] = '';
tt[4] = zz[1].split(':')[1];
tt[5] = zz.splice(4,zz.length).join(_vm);
ft.Write(tt.join(lsep));

fs.Close
ft.Close