home *** CD-ROM | disk | FTP | other *** search
/ PC World 2003 October / PCWorld_2003-10_cd.bin / Software / Vyzkuste / windowsxxl / windowsxxl.exe / Index.vbs < prev    next >
Text File  |  2003-07-19  |  3KB  |  148 lines

  1. dim n
  2. dim pfad(50000)
  3. dim suche(10)
  4.  
  5. Set myshell = CreateObject("wscript.shell")
  6. Set MyFiles = CreateObject("Scripting.FileSystemObject")
  7. Set AppShell  = CreateObject("Shell.Application")
  8. set C = MyShell.Environment("PROCESS")
  9. Quicklinks = C("windir") & "\Links\"
  10. Liste = C("windir") & "\INDEX.LST"
  11.  
  12. on error resume next
  13. if Not MyFiles.FolderExists(QuickLinks) then
  14.     MyFiles.CreateFolder(QuickLinks)
  15. end if
  16. set Linkfolder = MyFiles.getFolder(QuickLinks)
  17. set Links = Linkfolder.Files
  18.  
  19. if Not MyFiles.FileExists(Liste) then
  20.     Index
  21. end if
  22.  
  23. temp=myshell.popup("Chcete vytvo°it nov² seznam?",2,"",4)
  24. if temp=6 then index
  25.  
  26. set liste=MyFiles.OpenTextfile(liste)
  27. Do until liste.AtEndOfStream
  28.     n = n + 1
  29.     pfad(n)=ucase(liste.readline)
  30. loop
  31. liste.close
  32.  
  33. Suchen
  34.  
  35. '----------------------------------------------------------------------------
  36. Sub Suchen()
  37. frage=inputbox("Zadej v²raz(y) pro vyhledßvßnφ: ","",frage,1,1)
  38. if frage="" then wscript.quit
  39. frage=trim(ucase(frage))
  40. if len(frage) < 4 then
  41.     i=Msgbox ("Chcete skuteΦn∞ hledat: " & frage,4, "")
  42.     if i=7 then suchen ""
  43. end if
  44.  
  45. do 
  46.     s=s+1
  47.     i=instr(frage," ")
  48.     if i > 0 then
  49.         suche(s)=left(frage, i - 1)
  50.         frage=mid(frage,i+1)
  51.         frage=ltrim(frage)
  52.     else
  53.         suche(s)=frage
  54.     end if
  55. loop until i = 0
  56.  
  57. for each datei in Links
  58.     set del=myFiles.getfile(datei)
  59.     del.delete
  60. next
  61.  
  62. FOR p = 1 to n
  63. for i = 1 to s
  64.     if instr(pfad(p),suche(i)) then 
  65.         if i = s then 
  66.             if found = 50 then 
  67.                 i=myshell.run ("explorer.exe " & Quicklinks)
  68.                 myshell.sendkeys "{F5}"
  69.             end if
  70.             found = found + 1
  71.             song=pfad(p)
  72.             do
  73.                 x=instr(song,"\")
  74.                 if x > 0 then song=mid(song,x+1)
  75.             loop until x = 0
  76.             lnk = song & ".LNK"
  77.             Do
  78.                 L = L + 1
  79.                 if myFiles.FileExists(QuickLinks & Lnk) then lnk = song & "(" & L & ")" & ".LNK"
  80.             loop while myFiles.FileExists(QuickLinks & lnk)
  81.             L = 0
  82.             set link = MyShell.CreateShortcut(QuickLinks & lnk)
  83.             link.TargetPath=pfad(p)
  84.             link.save
  85.         end if
  86.     else
  87.         exit for
  88.     end if
  89. next
  90. next
  91.  
  92. if found=0 then 
  93.     set link = MyShell.CreateShortcut(QuickLinks & "Äßdn² soubor nenalezen.LNK")
  94.     link.TargetPath="notepad.exe"
  95.     link.save
  96. end if
  97. i=myshell.run ("explorer.exe " & Quicklinks)
  98. myshell.sendkeys "{F5}"
  99.  
  100. Suchen
  101. end sub
  102.  
  103. '---------------------------------------------------------------------------
  104. sub Index ()
  105.  
  106. Set AppFolder = Appshell.BrowseForFolder(0, "",  &H0001, 17)
  107. verz = AppFolder.ParentFolder.ParseName(AppFolder.Title).Path
  108. If err.number > 0 then
  109.         i=instr(AppFolder, ":")
  110.         verz = mid(AppFolder, i - 1, 1) & ":\"
  111. End If
  112. If verz="" Then wscript.quit
  113.  
  114. Set drive = MyFiles.GetFolder(verz)
  115. Set dat = drive.Files
  116. For Each datei In dat
  117.     n = n + 1
  118.       pfad(n) = datei.Path
  119. Next
  120.  
  121. Search drive
  122.  
  123. i=MsgBox (n & " soubor∙ zadßno. "  & chr(13) & "Budete zadßvat dalÜφ slo₧ku?",4,"")
  124. if i=6 then 
  125.     index
  126. end if
  127.  
  128. set indexlist=MyFiles.createtextfile(liste,TRUE)
  129. For p = 1 To n
  130.     indexlist.writeline pfad(p)
  131. Next
  132.  
  133. indexlist.close
  134. end sub
  135.  
  136. '-------------------------------------------------------------------
  137. Sub Search(ByVal StartFolder)
  138.     Set Weitere = StartFolder.SubFolders
  139.      For Each AktuellerOrdner In Weitere
  140.           Set dat = AktuellerOrdner.Files
  141.             For Each datei In dat
  142.                 n = n + 1
  143.                 pfad(n) = datei.Path
  144.             Next
  145.         Search AktuellerOrdner
  146.      Next
  147. End Sub
  148.