home *** CD-ROM | disk | FTP | other *** search
/ PC World 2005 July & August / PCWorld_2005-07-08_cd.bin / software / vyzkuste / tipy / tipy.exe / pcwLnkjas.HTA < prev    next >
Text File  |  2005-05-14  |  5KB  |  121 lines

  1. <HTML><!--
  2.  
  3.  
  4. License:     
  5. This program is free software; you can redistribute it and/or
  6. modify it under the terms of the GNU General Public License as
  7. published by the Free Software Foundation; either version 2 of
  8. the License, or (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. General Public License for more details.
  13. http://www.gnu.org/copyleft/gpl.html
  14.  
  15. Requirements:
  16. Windows 98, ME, 2000, XP
  17. IE 5.0, 5.5, 6.0 
  18. */-->
  19.  
  20. <HEAD>
  21. <TITLE>Skript PC-WORLDu: P°ejmenovßnφ zßstupc∙</TITLE>
  22. <HTA:APPLICATION ID="pcwLnkjas" APPLICATIONNAME="pcwLnkjas" BORDER="normal" CAPTION = "Yes" SHOWINTASKBAR = "yes" SINGLEINSTANCE = "yes" SYSMENU = "yes" WINDOWSTATE = "normal" SCROLL = "yes" SCROLLFLAT = "no" VERSION = "1.0" INNERBORDER = "no" SELECTION = "yes" MAXIMIZEBUTTON = "no" MINIMIZEBUTTON = "yes" NAVIGABLE = "yes" CONTEXTMENU = "yes" BORDERSTYLE = "normal" ICON="%WINDIR%\kill.exe"/>
  23. <STYLE type="text/css">
  24. body {font-family:Tahoma,Verdana,Arial,Geneva; font-size:12; background-color:Buttonface }
  25. table {font-family:Tahoma,Verdana,Arial,Geneva; font-size:12; background-color:Buttonface }
  26. </STYLE>
  27. </HEAD>
  28. <SCRIPT language="JScript">
  29.  
  30.  
  31. var Fs = new ActiveXObject("Scripting.FileSystemObject");
  32. var Ws = new ActiveXObject("WScript.Shell");
  33. var i=0; j=0; //reset counters
  34. var tabledata = "";
  35. var buttondata= ""; 
  36.  
  37.  
  38. function init() { 
  39.   window.resizeTo(510, 330);
  40.   setTimeout("startsuche()", 500); //forces an update of the application form
  41. }
  42.  
  43. /*
  44. function name: startsuche()
  45. parameters: void
  46. returns: void
  47. global vars: none, but expects a <DIV ID=keytable> to exist
  48. purpose: calls all the consecutive functions to search through folders that may contain hotkey-enabled URLs and LNKs
  49. */
  50.  
  51. function startsuche() {
  52.   var driveletter = new Enumerator(Fs.Drives);  
  53.   for (;!driveletter.atEnd(); driveletter.moveNext()) {
  54.     if (driveletter.item().DriveType == "2") {
  55.       findlnks(driveletter.item()+"\\");
  56.     }
  57.   }
  58.   document.all.keytable.innerHTML = "<TABLE width=\"100%\" border=\"2\" rules=\"rows\">"+tabledata+"</TABLE>";
  59.   document.all.statuszeile.innerHTML="<DIV style=font-size:12\"><B>ProhledanΘ soubory: </B>"+j+"</DIV>";
  60.   if (tabledata == "") {
  61.     document.all.keytable.innerHTML = "Nebyli nalezeni ₧ßdnφ zßstupci, kterΘ by bylo nutno p°ejmenovat.";
  62.   }
  63. }
  64.  
  65. function findlnks(folder) {
  66.   var f = Fs.GetFolder(folder);
  67.   var fnum = new Enumerator(f.Files);
  68.   for (;!fnum.atEnd(); fnum.moveNext()) {
  69.     if (Fs.GetExtensionName(fnum.item()).toLowerCase() == "lnk") {
  70.       j++
  71.       if (fnum.item().name.toLowerCase().indexOf("zßstupce - ")>-1) {
  72.       i++;
  73.       tabledata += "<TR><TD style=\"width:50px\"><Input Type=\"checkbox\" ID=B"+i+" onclick=\"renamentry(\'"+fnum.item().path.replace(/\\/g,"\\\\")+"\',\'"+i+"\')\" title=\"P°ejmenovat zßstupce\"/></TD><TD><SPAN ID=S"+i+" title=\""+fnum.item().path+"\">"+fnum.item().path+"</SPAN></TD></TR>"
  74.       }
  75.     }
  76.   }
  77.   fnum = new Enumerator(f.SubFolders);
  78.   for (;!fnum.atEnd(); fnum.moveNext()) {
  79.     findlnks(fnum.item());
  80.   }
  81. document.all.btnok.style.visibility = "visible";
  82. }
  83.  
  84. /*
  85. function name: renamentry(pfad, intval)
  86. parameters: pfad (string, path of an LNK file that will be renamed), intval (integer, a reference to it┤s HTML span element)
  87. returns:
  88. global vars:
  89. */
  90.  
  91. function renamentry(pfad, intval) {
  92.   if (document.all.item("B"+intval).checked == true ) {
  93.     document.all.item("S"+intval).innerText = document.all.item("S"+intval).innerText.replace(/Zßstupce - /g,"");
  94.   }
  95.   else { document.all.item("S"+intval).innerText = pfad; }
  96. }
  97.  
  98. function renamefiles() {
  99.   for (intval=1; intval < i+1; intval++) {
  100.     if (document.all.item("B"+intval).checked == true) {
  101.       document.all.item("B"+intval).style.visibility = "hidden";
  102.       try {
  103.     Fs.MoveFile(document.all.item("S"+intval).title, document.all.item("S"+intval).title.replace(/Zßstupce - /g,""));
  104.     document.all.item("S"+intval).innerText = document.all.item("S"+intval).innerText.replace(/Zßstupce - /g,"");
  105.     document.all.item("S"+intval).title = document.all.item("S"+intval).title.replace(/Zßstupce - /g,"");
  106.       }
  107.       catch(e) {
  108.     alert('\"' + document.all.item("S"+intval).title + '\" nelze p°ejmenovat.');
  109.       }
  110.     }
  111.   }
  112. }
  113.  
  114. </SCRIPT>
  115. <BODY scroll="no" onload="init()">
  116. <DIV ID=statuszeile></DIV><BR>
  117. <DIV ID=keytable style="overflow:auto; height:80%;"><B>Vyhledßvßm zßstupce na vÜech diskov²ch oddφlech.<BR>Bude to chvφli trvat...</B></DIV>
  118. <Input type="button" name="btnok" value="OK" style="visibility:hidden" onclick="renamefiles()">
  119. <HR style="height:2px; color:black">
  120. </BODY>
  121. </HTML>