Oh, good question! I couldn't find any autoproxy.pac style approach for this, so I opted for a fairly basic approach. I created two config files,
config.txt.work
(with forwarding and accept-intercepted-requests on) and config.txt.nofoward
(which is just the default config file for me). I then wrote a little PowerShell script to switch between these (use at your own risk! :)):$location=$args[0] $target=$env:ProgramFiles + "\Privoxy\config.txt" if ($location -eq "work") { $source=$target + ".work" } else { $source=$target + ".noforward" } cp -force "$source" "$target"
Based on the argument given to the script, this will just copy the required configuration file over Privoxy's
config.txt
file. I then setup two shortcuts pointing to this script, one to turn on work mode and the other to turn it off. The shortcut target looks something like this:C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -noexit "C:\Users\davesquared\Documents\Applications\PrivoxySwitch\PrivoxySwitch.ps1" work
You don't need the -noexit option, I just had it in for debugging. Note the command ends with the "work" argument, so the other shortcut should have "noforward" or something similar. Finally I set both shortcuts to run as Administrator so it has permission to copy the files. I've got the shortcuts in a location indexed by Launchy, so now I can just activate Launchy, type "switch work", ok the admin prompt, and I'm in work mode.
Is it worth it?
Yes, yes it is. Chrome is so nice. And you can do lots of fancy stuff with Privoxy if you delve into it. Have a quick glance through the Privoxy Quickstart and give it a
No comments:
Post a Comment