Sun, November 24, 2002

Enable/disable flash

A few days ago Blogzilla mentioned the jTFlashManager tool that lets you enable or disable flash on the fly. Investigating how the tool works shows that it just renames the plug-in file. I’ve been renaming the plug-in to disable it for a long time, but never tried doing this while the browser was running. For some reason I thought it read the plug-ins at startup.

The tool requires a Java VM to be installed and I thought that was overkill for renaming a file. I was a bit rusty, but wrote a DOS batch file that works beautifully as a shortcut from my Windows desktop. Save the toggleflash.bat file and then run it passing the path of your Phoenix, Mozilla, or Netscape plugin directory. If you’re not currently viewing a page using the flash or shockwave plug-ins, it will toggle them on or off.

Here’s the file:

@echo off
if “%1″=="” goto usage
if exist %1.\npswf32.dll goto disable
if exist %1.\npswf32.dll.off goto enable
echo Couldn’t find a flash plugin.
echo.
goto usage

:disable
ren %1.\npswf32.dll npswf32.dll.off
if exist %1.\np32dsw.dll ren %1.\np32dsw.dll np32dsw.dll.off
echo Flash Disabled.
goto done

:enable
ren %1.\npswf32.dll.off npswf32.dll
if exist %1.\np32dsw.dll.off ren %1.\np32dsw.dll.off np32dsw.dll
echo Flash Enabled.
goto done

:usage
echo You must specify the path to your browser’s plugins directory.
echo Put the path in double quotes if it includes spaces.
echo For example, toggleflash.bat "c:\Program Files\Mozilla\bin\plugins"

:done

Watch the tree grow     Thanksgiving