home *** CD-ROM | disk | FTP | other *** search
/ Freelog 117 / FreelogNo117-OctobreNovembre2013.iso / Theme / 8GadgetPack / 8GadgetPackSetup.msi / Gadgets.7z / Gadgets / Sidebar7.gadget / Main.js < prev    next >
Text (UTF-16)  |  2013-08-20  |  8KB  |  102 lines

  1.  
  2. var BetweenSpace = 5//Space between docked gadgets in pixels
  3. var TopSpace = 27;//Space between top of screen and first docked gadget
  4.  
  5. //If some program doesn't work with the minimized preview feature you can insert it here
  6. //If you are the developer of such a program you can use Sidebar7.h in this folder
  7. var MinimizedPreviewExceptions = "excel.exe/winamp.exe/PaintDotNet.exe/helium7.exe/trillian.exe/MediaMonkey (non-skinned).exe/MediaMonkey.exe";
  8.  
  9.  
  10. var version = 250
  11. var Native = null;
  12. var guid = "{0E7BE950-4ACC-47CB-834B-41A8B96BBFF9}";
  13. var typeLibGuid = "{51D5FC6F-AC9C-4FCA-B6A4-2421BD4AC5A6}";
  14. var progId = "Sidebar7.Sidebar7Gadget";
  15. var dllPath = System.Gadget.path+"\\Release\\Sidebar7.";  //"32.dll" or "64.dll" added later
  16.  
  17. function Load()
  18. {
  19.     ErrorText.innerHTML = Localized["ErrorText"];
  20.  
  21.     LoadNative();
  22.     Native.CheckVersion(version);
  23.     Native.Localized = LocalizedFunction;
  24.     Native.GadgetPath = System.Gadget.path+"\\";
  25.     Native.Init(BetweenSpace, TopSpace);
  26. }
  27.  
  28. function Unload()
  29. {
  30.     if(Native != null)
  31.         Native.Dispose();
  32.     Native = null;
  33. }
  34.  
  35. function LocalizedFunction(name)
  36. {
  37.     if(name == "MinimizedPreviewExceptions")
  38.         return MinimizedPreviewExceptions;
  39.     return Localized[name];
  40. }
  41.  
  42. function LoadNative()
  43. {
  44.     var firstError = "WScriptError: ";
  45.     try
  46.     {
  47.         var wshShell = new ActiveXObject("WScript.Shell"); 
  48.         try
  49.         {
  50.             RegisterNative(wshShell, "HKLM");
  51.         }
  52.         catch(err)
  53.         {
  54.             firstError = err.name + ": " + err.number + ", " + err.message + "<br/>";
  55.             RegisterNative(wshShell, "HKCU");
  56.         }
  57.     }
  58.     catch(err)
  59.     {
  60.         ErrorText.innerHTML = firstError + err.name + ": " + err.number + ", " + err.message;
  61.         document.body.style.width = "400px";
  62.         document.body.style.height = "200px";
  63.     }
  64. }
  65.  
  66. function RegisterNative(wshShell, root)
  67. {
  68.     var dllPost = "";
  69.     if(System.Machine.processorArchitecture.indexOf("64") != -1)
  70.         dllPost = "64.dll";
  71.     else
  72.         dllPost = "32.dll";
  73.     wshShell.RegWrite(root + "\\Software\\Classes\\" + progId + "\\", progId);
  74.     wshShell.RegWrite(root + "\\Software\\Classes\\" + progId + "\\CLSID\\", guid);
  75.     wshShell.RegWrite(root + "\\Software\\Classes\\" + progId + "\\CurVer\\", progId + ".1");
  76.  
  77.     wshShell.RegWrite(root + "\\Software\\Classes\\CLSID\\" + guid + "\\", progId);
  78.     wshShell.RegWrite(root + "\\Software\\Classes\\CLSID\\" + guid + "\\InprocServer32\\", dllPath+dllPost);
  79.     wshShell.RegWrite(root + "\\Software\\Classes\\CLSID\\" + guid + "\\InprocServer32\\ThreadingModel", "Apartment");
  80.     wshShell.RegWrite(root + "\\Software\\Classes\\CLSID\\" + guid + "\\ProgID\\", progId + ".1");
  81.     wshShell.RegWrite(root + "\\Software\\Classes\\CLSID\\" + guid + "\\TypeLib\\", typeLibGuid);
  82.     wshShell.RegWrite(root + "\\Software\\Classes\\CLSID\\" + guid + "\\VersionIndependentProgID\\", progId);
  83.  
  84.     wshShell.RegWrite(root + "\\Software\\Classes\\TypeLib\\" + typeLibGuid + "\\1.0\\", progId + " - TypeLib");
  85.     wshShell.RegWrite(root + "\\Software\\Classes\\TypeLib\\" + typeLibGuid + "\\1.0\\0\\win32\\", dllPath+dllPost);
  86.     wshShell.RegWrite(root + "\\Software\\Classes\\TypeLib\\" + typeLibGuid + "\\1.0\\FLAGS\\", "0");
  87.     wshShell.RegWrite(root + "\\Software\\Classes\\TypeLib\\" + typeLibGuid + "\\1.0\\HELPDIR\\", "");
  88.  
  89. /*    try
  90.     {*/
  91.         Native = new ActiveXObject(progId); 
  92. /*    }
  93.     finally
  94.     {
  95.         wshShell.RegDelete(root + "\\Software\\Classes\\" + progId + "\\CLSID\\");
  96.         wshShell.RegDelete(root + "\\Software\\Classes\\" + progId + "\\");
  97.         wshShell.RegDelete(root + "\\Software\\Classes\\CLSID\\" + guid + "\\InprocServer32\\");
  98.         wshShell.RegDelete(root + "\\Software\\Classes\\CLSID\\" + guid + "\\ProgId\\");
  99.         wshShell.RegDelete(root + "\\Software\\Classes\\CLSID\\" + guid + "\\");
  100.     }*/
  101. }
  102.