View Single Post
Old 17th January 2007, 01:48   #64  |  Link
tonyp12
Registered User
 
Join Date: Oct 2002
Location: Florida, USA
Posts: 90
TitleSorter 1.3 is done.

Download here


Just put in your same folder as keydb.cfg file.
(shortcut on desktop is OK)

You can cut & paste titles you see from this forum.
Just grab as much as you can, my program will not
add duplicate Sha1's.

It will tabulate (with spaces) so all text looks neat.

And it will save the new text file back when you press OK.

You should Start with this one:keydb.cfg v1.2
As other versions may have missing 'return key' at end of line
or to many at end of file.

You can cut and paste from your keydb file if you think you have additional keys, but run the inputs through my program.

Source code if you're interested in how javascript can do this, the file itself is the same if opened with notepad.
Code:
<html>
<head>
<title>TitleSorter 1.3</title>
<script>

function Readfile() {

  var newkeystrings=[]
  var buf = document.forms[0].keyinput.value + '\r\n'
  newkeystrings = buf.replace(/\t/g, ' ').split('\n');
  
  keys=new Array();
  var fso=new ActiveXObject("Scripting.FileSystemObject");
  var openkeys=fso.openTextFile("KEYDB.cfg",1);
  var keystring=[];
  var buf = openkeys.readall() + '\r\n';      
  

var i = newkeystrings.length-1

do 
   { 
    var buf2= newkeystrings[i]
    if (buf.indexOf(buf2.substring(0, 40))>=0 || buf2.charAt(40) != '=') //search for duplicates or missing = (on inputs)
     {
     newkeystrings.splice(i, 1)
     }
    i--
   }  
 while (i > -1)
      
  
  document.write('<pre>' + newkeystrings.join('<br>'));
  document.write('<br>The titles(' + newkeystrings.length + ') above added. <br>');
  keystring = buf.replace(/\t/g, ' ').split('\n'); // to get all individual lines 
 
  var j = keystring.length
  for (var i=0; i< newkeystrings.length; i++)
   {
   keystring[j+i]=newkeystrings[i]                    // add new titles
   } 
 

  var i = keystring.length-1
  do
   {
     if (keystring[i].charAt(40) != '=')                       //search for missing =
     {
     keystring.splice(i, 1)
     }  
    i--
   }
   while (i > -1)

  for (var i=0; i<=(keystring.length-1); i++)
 {
  
  var j=keystring[i].indexOf('|')
  if (j < 79)  // search for the first '|' 
   {   
    var buf1=keystring[i].slice(0,j)
    var buf2=keystring[i].slice(j)
    var buf3="                                      ".slice(0,79-j); // tabbing
    keystring[i]=buf1.concat(buf3, buf2) 
   }
  else if (j > 79)   
   {   
    var buf1=keystring[i].slice(0,79)
    var buf2=keystring[i].slice(j)  
    keystring[i]=buf1.concat(buf2) 
   }
 }

 function byname(a, b) {
   if (a.substring(41) == b.substring(41)) { return(0); }
   else if (a.substring(41) > b.substring(41)) { return(1); }
   else if (a.substring(41) < b.substring(41)) { return(-1); }
   }
  
  keystring.sort(byname)

  document.write('<b>' + keystring.join('<br>'));
  openkeys.close()
  alert ('Your new list have ' + keystring.length + ' titles, press OK to save and copy to clipboard')
  
  fso = new ActiveXObject("Scripting.FileSystemObject");
  fso.CreateTextFile('keydb.cfg');
  a = fso.GetFile('keydb.cfg');
  b = a.OpenAsTextStream(2,0); //ForWriting, TristateFalse
  b.Write(keystring.join('\n') + '\n');
  b.Close();

     if( window.clipboardData && clipboardData.setData )
       {
       buf= keystring.join('\n') + '\n';
       clipboardData.setData("text", buf);
       }

// *** This will take Janvitos to his post if a new key is detected, change 999 to 0 to activate ***
  if (newkeystrings.length > 999)
   {
   myRef = window.open('http://forum.doom9.org/editpost.php?do=editpost&p=933519','doom9',
   'left=20,top=20,width=800,height=800,toolbar=0,resizable=1,scrollbars=1');
   }
}

</script>
</head>
<body>
Cut & paste any new titles below, duplicates will be ignored <img src="http://www.dvdfllc.co.jp/img/l_hdgen.gif" align="middle"><br>

<FORM NAME="newkeys" ACTION="" onsubmit="Readfile()">
<TEXTAREA NAME=keyinput COLS=128 ROWS=6></TEXTAREA>
<P><INPUT TYPE=SUBMIT VALUE="Load original keydb, Merge and Sort">
</FORM>

</body>
</html>
Update to 1.3
It Paste the list to your clipboard
Optional 'go to website' if new keys are added (have to edit file and change 999 to 0 to activate)

Last edited by tonyp12; 18th January 2007 at 21:30.
tonyp12 is offline   Reply With Quote