<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>迷途知返 &#187; VBS</title>
	<atom:link href="http://pwwang.com/category/technology/vbs/feed/" rel="self" type="application/rss+xml" />
	<link>http://pwwang.com</link>
	<description>专注技术,用心生活!</description>
	<lastBuildDate>Fri, 02 Jul 2010 02:26:53 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Windows代理快速切换VBS版</title>
		<link>http://pwwang.com/technology/vbs/windows%e4%bb%a3%e7%90%86%e5%bf%ab%e9%80%9f%e5%88%87%e6%8d%a2vbs%e7%89%88/</link>
		<comments>http://pwwang.com/technology/vbs/windows%e4%bb%a3%e7%90%86%e5%bf%ab%e9%80%9f%e5%88%87%e6%8d%a2vbs%e7%89%88/#comments</comments>
		<pubDate>Thu, 27 Nov 2008 16:57:47 +0000</pubDate>
		<dc:creator>pwwang</dc:creator>
				<category><![CDATA[VBS]]></category>

		<guid isPermaLink="false">http://pwwang.com/?p=27</guid>
		<description><![CDATA[1

2

3

<span class="readmore"><a href="http://pwwang.com/technology/vbs/windows%e4%bb%a3%e7%90%86%e5%bf%ab%e9%80%9f%e5%88%87%e6%8d%a2vbs%e7%89%88/" title="Windows代理快速切换VBS版">Read More: 2500 Words Totally</a></span>]]></description>
			<content:encoded><![CDATA[
<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
</pre></td><td class="code"><pre class="vb" style="font-family:monospace;"><span style="color: #008000;">'on error resume next
</span><span style="color: #008000;">'msgbox &quot;All these settings are aviable till the browser restarted!&quot;,vbInformation,&quot;ProxyShift&quot; 
</span>
<span style="color: #000080;">dim</span> ws,pe,proxy,proxy1,proxycount,i,r
<span style="color: #000080;">const</span> REGDIR=<span style="color: #800000;">&quot;HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionInternet Settings&quot;</span> 
&nbsp;
<span style="color: #000080;">Set</span> ws = WScript.CreateObject(<span style="color: #800000;">&quot;WScript.Shell&quot;</span>)
readValues
<span style="color: #000080;">if</span> pe=0 <span style="color: #000080;">then</span>
    <span style="color: #000080;">if</span> msgbox(<span style="color: #800000;">&quot;Proxy is disabled, enable it?&quot;</span>,vbYesNo,<span style="color: #800000;">&quot;ProxyShift&quot;</span>)=vbYes <span style="color: #000080;">then</span>
        <span style="color: #000080;">if</span> proxy=<span style="color: #800000;">&quot;&quot;</span> <span style="color: #000080;">then</span>
            proxy=InputBox(<span style="color: #800000;">&quot;Input proxy server&quot;</span>,<span style="color: #800000;">&quot;ProxyShift&quot;</span>)
            <span style="color: #000080;">if</span> proxy&lt;&gt; <span style="color: #800000;">&quot;&quot;</span> <span style="color: #000080;">then</span>
                ws.RegWrite REGDIR &amp;#038; <span style="color: #800000;">&quot;ProxyServer&quot;</span>,proxy,<span style="color: #800000;">&quot;REG_SZ&quot;</span>
                ws.RegWrite REGDIR &amp;#038; <span style="color: #800000;">&quot;ProxyServer1&quot;</span>,proxy,<span style="color: #800000;">&quot;REG_SZ&quot;</span>
                ws.RegWrite REGDIR &amp;#038; <span style="color: #800000;">&quot;ProxyCount&quot;</span>,<span style="color: #800000;">&quot;1&quot;</span>,<span style="color: #800000;">&quot;REG_SZ&quot;</span>
            <span style="color: #000080;">end</span> <span style="color: #000080;">if</span>
        <span style="color: #000080;">else</span>
            <span style="color: #000080;">Call</span> ChangeProxy
        <span style="color: #000080;">end</span> <span style="color: #000080;">if</span>
        ws.RegWrite REGDIR &amp;#038; <span style="color: #800000;">&quot;ProxyEnable&quot;</span>,1,<span style="color: #800000;">&quot;REG_DWORD&quot;</span>
        msgbox <span style="color: #800000;">&quot;ProxyServer setted!&quot;</span>,vbInformation,<span style="color: #800000;">&quot;ProxyShift&quot;</span>
    <span style="color: #000080;">end</span> <span style="color: #000080;">if</span>
<span style="color: #000080;">else</span>
    r=msgbox(<span style="color: #800000;">&quot;Proxy server list: &quot;</span> &amp;#038; vbcrlf &amp;#038; vbcrlf &amp;#038; get_Proxystr &amp;#038; vbcrlf &amp;#038; <span style="color: #800000;">&quot;Disable or change it?&quot;</span> &amp;#038; vbcrlf &amp;#038; vbcrlf &amp;#038; <span style="color: #800000;">&quot;[YES] for disable, [NO] for change&quot;</span>,vbYesNoCancel,<span style="color: #800000;">&quot;ProxyShift&quot;</span>)
    <span style="color: #000080;">if</span> r=vbYes <span style="color: #000080;">then</span>
        ws.RegWrite REGDIR &amp;#038; <span style="color: #800000;">&quot;ProxyEnable&quot;</span>,0,<span style="color: #800000;">&quot;REG_DWORD&quot;</span>
        msgbox <span style="color: #800000;">&quot;Proxy disabled!&quot;</span>,vbInformation,<span style="color: #800000;">&quot;ProxyShift&quot;</span>
    <span style="color: #000080;">elseif</span> r=vbNo <span style="color: #000080;">then</span>
        <span style="color: #000080;">Call</span> ChangeProxy
        msgbox <span style="color: #800000;">&quot;ProxyServer setted!&quot;</span>,vbInformation,<span style="color: #800000;">&quot;ProxyShift&quot;</span>
    <span style="color: #000080;">end</span> <span style="color: #000080;">if</span>
<span style="color: #000080;">end</span> <span style="color: #000080;">if</span> 
&nbsp;
<span style="color: #000080;">Function</span> get_Proxystr
<span style="color: #000080;">dim</span> proxystr
proxystr=<span style="color: #800000;">&quot;&quot;</span>
proxy=ws.RegRead(REGDIR &amp;#038; <span style="color: #800000;">&quot;ProxyServer&quot;</span>)
proxycount=ws.RegRead(REGDIR &amp;#038; <span style="color: #800000;">&quot;ProxyCount&quot;</span>)
<span style="color: #000080;">for</span> i=1 <span style="color: #000080;">to</span> proxycount
    proxy1=ws.RegRead(REGDIR &amp;#038; <span style="color: #800000;">&quot;ProxyServer&quot;</span> &amp;#038; i)
    <span style="color: #000080;">if</span> proxy1 = <span style="color: #800000;">&quot;&quot;</span> <span style="color: #000080;">then</span> proxy1 = proxy
    proxystr=proxystr &amp;#038; i <span style="color: #800000;">&quot;. &quot;</span> &amp;#038; proxy1
    <span style="color: #000080;">if</span> proxy1=proxy <span style="color: #000080;">then</span> proxystr = proxystr &amp;#038; <span style="color: #800000;">&quot; (DEFAULT)&quot;</span>
    proxystr=proxystr &amp;#038; vbcrlf
<span style="color: #000080;">next</span>
get_Proxystr=proxystr
<span style="color: #000080;">end</span> <span style="color: #000080;">Function</span> 
&nbsp;
<span style="color: #000080;">sub</span> ChangeProxy
<span style="color: #000080;">dim</span> pindex
r=msgbox(<span style="color: #800000;">&quot;Proxy server list:&quot;</span> &amp;#038; vbcrlf &amp;#038; vbcrlf &amp;#038; get_Proxystr &amp;#038; vbcrlf &amp;#038; <span style="color: #800000;">&quot;Change the DEFAULT proxy server?&quot;</span> &amp;#038; vbcrlf &amp;#038; vbcrlf &amp;#038; <span style="color: #800000;">&quot;[YES] for change, [NO] for a new proxy server, [CANCEL] for use default&quot;</span>, vbYesNoCancel,<span style="color: #800000;">&quot;ProxyShift&quot;</span>)
<span style="color: #000080;">if</span> r=vbYes <span style="color: #000080;">then</span>
    pindex=InputBox(<span style="color: #800000;">&quot;Input proxy server index&quot;</span>,<span style="color: #800000;">&quot;ProxyShift&quot;</span>)
    ws.RegWrite REGDIR &amp;#038; <span style="color: #800000;">&quot;ProxyServer&quot;</span>,ws.RegRead(REGDIR &amp;#038; <span style="color: #800000;">&quot;ProxyServer&quot;</span> &amp;#038; pindex),<span style="color: #800000;">&quot;REG_SZ&quot;</span>
    msgbox <span style="color: #800000;">&quot;Proxy server &quot;</span> &amp;#038; pindex &amp;#038; <span style="color: #800000;">&quot; set as default!&quot;</span>,vbInformation,<span style="color: #800000;">&quot;ProxyShift&quot;</span>
<span style="color: #000080;">elseif</span> r=vbNo <span style="color: #000080;">then</span>
    <span style="color: #000080;">dim</span> newserver
    newserver=InputBox(<span style="color: #800000;">&quot;Input a new proxy server:&quot;</span>,<span style="color: #800000;">&quot;ProxyShift&quot;</span>)
    <span style="color: #000080;">if</span> newserver&lt;&gt;<span style="color: #800000;">&quot;&quot;</span> <span style="color: #000080;">then</span>
        ws.RegWrite REGDIR &amp;#038; <span style="color: #800000;">&quot;ProxyServer&quot;</span>,newserver,<span style="color: #800000;">&quot;REG_SZ&quot;</span>
        ws.RegWrite REGDIR &amp;#038; <span style="color: #800000;">&quot;ProxyServer&quot;</span> &amp;#038; proxycount+1,newserver,<span style="color: #800000;">&quot;REG_SZ&quot;</span>
        ws.RegWrite REGDIR &amp;#038; <span style="color: #800000;">&quot;ProxyCount&quot;</span>,proxycount+1,<span style="color: #800000;">&quot;REG_SZ&quot;</span>
        <span style="color: #008000;">'msgbox &quot;ProxyServer setted!&quot;,vbInformation,&quot;ProxyShift&quot;
</span>    <span style="color: #000080;">end</span> <span style="color: #000080;">if</span>
<span style="color: #000080;">end</span> <span style="color: #000080;">if</span>
<span style="color: #000080;">end</span> <span style="color: #000080;">sub</span> 
&nbsp;
<span style="color: #000080;">sub</span> readValues
<span style="color: #000080;">on</span> <span style="color: #000080;">error</span> <span style="color: #000080;">resume</span> <span style="color: #000080;">next</span>
proxy=ws.RegRead(REGDIR &amp;#038; <span style="color: #800000;">&quot;ProxyServer&quot;</span>)
proxycount=ws.RegRead(REGDIR &amp;#038; <span style="color: #800000;">&quot;ProxyCount&quot;</span>)
<span style="color: #000080;">if</span> isnull(proxycount) <span style="color: #000080;">or</span> proxycount=<span style="color: #800000;">&quot;&quot;</span> <span style="color: #000080;">then</span>
    ws.RegWrite REGDIR &amp;#038; <span style="color: #800000;">&quot;ProxyServer1&quot;</span>,proxy,<span style="color: #800000;">&quot;REG_SZ&quot;</span>
    ws.RegWrite REGDIR &amp;#038; <span style="color: #800000;">&quot;ProxyCount&quot;</span>,<span style="color: #800000;">&quot;1&quot;</span>,<span style="color: #800000;">&quot;REG_SZ&quot;</span>
<span style="color: #000080;">end</span> <span style="color: #000080;">if</span>
proxycount=ws.RegRead(REGDIR &amp;#038; <span style="color: #800000;">&quot;ProxyCount&quot;</span>)
pe=ws.RegRead(REGDIR &amp;#038; <span style="color: #800000;">&quot;ProxyEnable&quot;</span>)
<span style="color: #000080;">end</span> <span style="color: #000080;">sub</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://pwwang.com/technology/vbs/windows%e4%bb%a3%e7%90%86%e5%bf%ab%e9%80%9f%e5%88%87%e6%8d%a2vbs%e7%89%88/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
