' *************************************** ' * * ' * Commutateur pour flash * ' * d'après une idée de * ' * Daniel92 et un CLSID de JacK * ' * Fonction testarg par JCB * ' * Version 1.0 * ' * * ' * Script ~Jean-Marc~ 05/2005 * ' * http://docxp.mvps.org * ' * * ' *************************************** ' ------------- initialisation des objets Dim shell, args Const ForWriting=2 Set shell = WScript.CreateObject("WScript.Shell") Set args = Wscript.Arguments nbargs = args.count ' ------------------(dés)Installer le bouton------------------ If nbargs > 0 Then WinDir = shell.ExpandEnvironmentStrings("%windir%") IEBtnCLSID = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Extensions\{AF4F850C-68FE-404D-8418-549F86B1E238}\" If testarg("i") or testarg("install") Then shell.RegWrite IEBtnCLSID & "CLSID", "{1FBA04EE-3024-11d2-8F1F-0000F87ABD16}", "REG_SZ" shell.RegWrite IEBtnCLSID & "ButtonText", "Bascule FLASH", "REG_SZ" shell.RegWrite IEBtnCLSID & "Exec", WScript.ScriptFullName, "REG_SZ" shell.RegWrite IEBtnCLSID & "icon", WinDir & "\system32\shell32.dll,40", "REG_SZ" shell.RegWrite IEBtnCLSID & "hoticon", WinDir & "\system32\shell32.dll,40", "REG_SZ" shell.RegWrite IEBtnCLSID & "Default Visible", "yes", "REG_SZ" Msg = "Fermez et ouvrez I.E. Si le bouton est absent :" & vbcrlf Msg = Msg & "Aller dans I.E. > Clic droit sur la barre d'outils > Personnaliser" & vbcrlf Msg = Msg & "Ajoutez le bouton" MsgBox Msg, 64 wscript.quit end if If testarg("u") or testarg("uninstall") Then on error resume next shell.RegDelete IEBtnCLSID & "CLSID" shell.RegDelete IEBtnCLSID & "ButtonText" shell.RegDelete IEBtnCLSID & "Exec" shell.RegDelete IEBtnCLSID & "icon" shell.RegDelete IEBtnCLSID & "hoticon" shell.RegDelete IEBtnCLSID & "Default Visible" shell.RegDelete IEBtnCLSID on error goto 0 MsgBox "Bouton désinstallé" , 64 wscript.quit end if If testarg("?") or testarg("h") Then msg="------- Bascule Flash -------" & VBCRLF & VBCRLF msg=msg & "Installation avec /i ou /install" & VBCRLF msg=msg & "Désinstallation avec /u ou /uninstall" & VBCRLF msgbox msg,32 wscript.quit end if end if ' ----------------- Flash Bloqué ? ---------------------- FlashAX = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\ActiveX Compatibility\" FlashAX = FlashAX & "{D27CDB6E-AE6D-11CF-96B8-444553540000}\Compatibility Flags" FlashBlocked = false on error resume next FlashBlocked = (shell.regread(FlashAX) = 1024) on error goto 0 ' ----------------- Basculer ---------------------- ' Si erreur "racine incorrecte", le script n'est pas ' lancé avec des droits suffisants pour écrire dans HKLM ' (compte limité ou I.E. lancé en droits réduits) if FlashBlocked then shell.RegDelete FlashAX MsgBox "Flash Activé" & vbcrlf & vbcrlf & "Relancez I.E.", 64 else shell.RegWrite FlashAX, 1024, "REG_DWORD" MsgBox "Flash Bloqué"& vbcrlf & vbcrlf & "Relancez I.E.", 64 end if ' Libération des objets Set shell = nothing Set args = nothing Wscript.quit '-------------------------------------------------------- '-------------------------------------------------------- '------------------ FIN --------------------- '-------------------------------------------------------- '-------------------------------------------------------- '------------------------ Fonctions Annexes --------------------- Function testarg(param) testarg=false For i = 0 To nbargs-1 curarg=lcase(args(i)) If left(curarg,1)="/" or left(curarg,1)="-" Then If mid(curarg,2,len(param))=param Then testarg=true exit function End If End If Next End Function