home *** CD-ROM | disk | FTP | other *** search
/ PC World 2005 May / PCWorld_2005-05_cd.bin / software / vyzkuste / zastupci / zastupci.exe / pcwMultilink.VBS < prev    next >
Text File  |  2005-03-13  |  3KB  |  106 lines

  1. dim menuname(40)
  2. dim ziel(40)
  3. dim Parameter(40)
  4. dim Symbol(40)
  5. Set myfiles = CreateObject("Scripting.FileSystemObject")
  6. Set myshell = CreateObject("Wscript.Shell")
  7. mydesktop=myShell.SpecialFolders("Desktop")
  8.  
  9. on error resume next
  10. lnkfolder=mydesktop & "\Links.TMP"
  11. set lnkfolder=MyFiles.Getfolder(mydesktop & "\Links.TMP")
  12. set linkfiles=lnkfolder.Files
  13. for each link in linkfiles
  14.     check=ucase(right(link.name,4))
  15.     if check=".LNK" Or check=".PIF" then
  16.         clink=clink+1
  17.         menuname(clink)=left(link.name,len(link.name)-4)
  18.         set multilink=MyShell.CreateShortcut(link.path)
  19.         ziel(clink)=multilink.Targetpath
  20.         Parameter(clink)=multilink.Arguments
  21.         Symbol(clink)=multilink.IconLocation
  22.     end if
  23. next
  24.  
  25. if clink=0 then
  26.     msgbox "Ve slo₧ce " & mydesktop & "\LINKS.TMP nejsou ₧ßdnφ zßstupci, kterΘ by bylo mo₧nΘ p°enΘst do kontextovΘho menu novΘho typu souboru."
  27.     wscript.quit
  28. end if
  29.  
  30. for temp=1 to clink
  31.     allmenus=allmenus & "(" & temp & ") " & menuname(temp) & chr(13)
  32. next
  33.  
  34. mainjob=inputbox(clink & " odkaz(y) nalezeny. Vyberte hlavnφ odkaz, kter² se mß provΘst p°i poklepßnφ na zßstupce:" & chr(13) & chr(13) & allmenus)
  35. for temp=1 to clink
  36.     if mainjob = cstr(temp) then 
  37.         mainok=1
  38.         exit for
  39.     end if
  40. next
  41.  
  42. if mainok=0 then wscript.quit
  43. if Parameter(mainjob)="" then
  44.     MainCommand=ziel(mainjob) & " %*"
  45. else
  46.     MainCommand=ziel(mainjob) & " " & Parameter(mainjob) & " %*"
  47. end if
  48.  
  49. if len(symbol(mainjob))<4 then
  50.     set IsEXE=MyFiles.GetFile(ziel(mainjob))
  51.     if ucase(right(IsEXE.Name,3))="EXE" then symbol(mainjob)=IsEXE.path & ",0"
  52. end if
  53. if len(symbol(mainjob))<4 then
  54.     err.clear
  55.     set IsFolder=MyFiles.GetFolder(ziel(mainjob))
  56.     if err.number=0 then    symbol(mainjob)="Shell32.dll,3"
  57. end if
  58. if len(symbol(mainjob))<4 then
  59.     symbol(mainjob)="pifmgr.dll," & counter + 3
  60. end if
  61.  
  62. counter=myshell.regRead("HKCR\V00File\V00Links")
  63. if counter="" then 
  64.     counter=0
  65.     myshell.regwrite("HKCR\V00File\V00Links"),"0"
  66.     Erweiterung="V00"
  67. else
  68.     counter=counter + 1
  69.     if counter < 10 then
  70.         Erweiterung="V0" & counter
  71.     else
  72.         Erweiterung="V" & counter
  73.     end if
  74.     myshell.regwrite("HKCR\V00File\V00Links"),counter
  75. end if
  76.  
  77. Dateityp=Erweiterung & "File"
  78.  
  79. msgbox "Registr nynφ obsahuje nov² datov² typ souboru - " & Dateityp
  80. myshell.regwrite("HKCR\." & Erweiterung & "\"),Dateityp
  81. myshell.regwrite("HKCR\" & Dateityp & "\"),"VBScript"
  82. myshell.regwrite("HKCR\" & Dateityp & "\NeverShowExt"),""
  83. myshell.regwrite("HKCR\" & Dateityp & "\DefaultIcon\"),symbol(mainjob)
  84. myshell.regwrite("HKCR\" & Dateityp & "\ScriptEngine\"),"VBScript"
  85. myshell.regwrite("HKCR\" & Dateityp & "\Shell\"),""
  86. myshell.regwrite("HKCR\" & Dateityp & "\Shell\Open\"),""
  87. myshell.regwrite("HKCR\" & Dateityp & "\Shell\Open\Command\"),maincommand
  88. myshell.regwrite("HKCR\" & Dateityp & "\ShellEx\"),""
  89. myshell.regwrite("HKCR\" & Dateityp & "\ShellEx\DropHandler\"),"{60254CA5-953B-11CF-8C96-00AA00B8708C}"
  90.  
  91. for temp=1 to clink
  92.     if not cstr(temp) = mainjob then
  93.         myshell.regwrite("HKCR\" & Dateityp & "\Shell\" & menuname(temp) & "\"),""
  94.         myshell.regwrite("HKCR\" & Dateityp & "\Shell\" & menuname(temp) & "\Command\"),ziel(temp) & " " & parameter(temp)
  95.     end if
  96. next
  97.  
  98. datei=mydesktop & "\" & menuname(mainjob) & "." & Erweiterung
  99. set multilink=myFiles.CreateTextFile(datei)
  100. multilink.writeline "-- Poznßmky --"
  101.  
  102.     
  103.  
  104.  
  105.  
  106.