1.猜数字游戏(编码为ANSI)
Dim WshShell,BtnCode
Set WshShell=WScript.CreateObject("WScript.Shell")
Randomize()
Num=Int(99*Rnd())
BtnCode=WshShell.Popup("请猜数大于50",,"请选择",4+32)
Select Case BtnCode
Case 6 If Num>50 Then MsgBox "恭喜你,你赢了!" Else msgbox "你选错了哦,别气馁!数字为:" & Num
Case 7 If Num<50 Then MsgBox "恭喜你,你赢了!" Else msgbox "你选错了哦,别气馁!数字为:" & Num
End Select
2.电脑说话(编码为ANSI)
CreateObject("SAPI.SpVoice").Speak "要说的话"
3.电脑问好(编码为ANSI)
d=Date()
t=Time()
h=Hour(t) '获取到当前的小时
if h<9 then
k="早上"
elseif h<12 then
k="上午"
elseif h<14 then
k="中午"
elseif h<18 then
k="下午"
else
k="晚上"
end if
lady="主人," & k & "好呀!"
CreateObject("SAPI.SpVoice").Speak(lady)
4.键盘走马灯(编码为UTF-8)
Set wshShell=wscript.CreateObject("WScript.Shell")
do
wscript.sleep 100
wshShell.sendkeys "{CAPSLOCK}"
wshShell.sendkeys "{NUMLock}"
wshShell.sendkeys "{SCROLLLock}"
loop
5.数字游戏(编码为ANSI)
Randomize
dim a,b,c
c = msgbox ("如果什么也不输入,下一步点击确定键,自动退出游戏,另需要提示随机数吗",1,"提示")
a = int(round (rnd*100))
b = inputbox("请输入一个1~100整数:","猜数字")
mysub a,b,c
sub mysub (a,b,c)
if (c=1) then
msgbox ("随机数:"&a&",我输入的:"&b)
end if
if not isnumeric(b) then
msgbox "退出游戏"
else
select case sgn(b-a)
case 0
msgbox "恭喜答对"
case 1
msgbox "输入的数值太大了"
b = inputbox("请输入一个1~100整数:","猜数字")
mysub a,b,c
case -1
msgbox "输入的数值太小了"
b = inputbox("请输入一个1~100整数:","猜数字")
mysub a,b,c
end select
end if
end sub
6.信息(编码为ANSI)
msgbox "你好",vbinfonation,"信息"
7.选择关机(编码为ANSI)
on error resume next
dim a,WSHshel1
a = msgbox ("是否在一分钟内关机?",1,"关机界面")
set WSHshell = wscript.createobject("wscript.shell")
if (a =1) then
WSHshell.run "cmd.exe /c shutdown -s -t 60 -c ""一分钟内关机...""",0,true
else
WSHshell.run "cmd.exe /c shutdown -a",0,true
end if
8.音量控制(编码为ANSI)
Set ws = CreateObject("WScript.Shell")
ws.SendKeys Chr(&H88AD) '静音非静音切换
ws.SendKeys Chr(&H88AE) '减小音量
ws.SendKeys Chr(&H88AF) '增大音量
9. 可控语速的电脑说话(编码为ANSI)
Set objVoice = CreateObject("SAPI.SpVoice")
'Set objVoice.Voice = objVoice.GetVoices("Name=Microsoft Simplified Chinese").Item(0)
objVoice.Rate = 0 '速度:-10,10 0
objVoice.Volume = 100 '音量:0,100 100
objVoice.Speak "主人好"
10.聊天轰炸不带数字(编码为ANSI)
Set WshShell= WScript.CreateObject("WScript.Shell")
WshShell.AppActivate "名字"
for i=1 to 300
WScript.Sleep 500
WshShell.SendKeys "^v"
WshShell.SendKeys "%s"
Next
11..聊天轰炸带数字(编码为ANSI)
Set WshShell= WScript.CreateObject("WScript.Shell")
WshShell.AppActivate "名字"
for i=1 to 3
WScript.Sleep 500
WshShell.SendKeys "^v"
WshShell.SendKeys i
WshShell.SendKeys "%s"
Next
以上所有源码已全部上传至CSDN资源
更多推荐
.VBS源码大放送2
发布评论