vbs small program collection

1. The
effect of the computer speaking program The
computer said: "The one who opened me is a pig".
code

set objTTS = createobject("sapi.spvoice")
objTTS.speak "打开我的人是猪"

2. The
effect of the program saying "I am a pig"
Enter "I am a pig", otherwise it will shut down after one minute.
code

on error resume next
dim WSHshellA
set WSHshellA = wscript.createobject("wscript.shell")
WSHshellA.run "cmd.exe /c shutdown -r -t 180 -c ""说我是猪,不说我是猪一分钟后就关机"" ",0 ,true
dim a
do while(a <> "我是猪")
a = inputbox ("说我是猪,就不关机,说 ""我是猪"" ","说不说","不说",8000,7000)
loop
msgbox "早说就行了嘛"
dim WSHshell
set WSHshell = wscript.createobject("wscript.shell")
WSHshell.run "cmd.exe /c shutdown -a",0 ,true
msgbox "哈哈哈哈,好乖"

3. The
effect of the love test program
Enter the person you like and stop the program if it is "Zhang San" (the string can be changed), otherwise the program will be executed indefinitely.
code

const title = "爱情测试"
const yourname = "张三"
const question = "你最喜欢的人是谁?请在下面的方框中输入他(她)的名字。"
const info = "你在说谎!不要逃避,实话实说。"
const scend = "你说出了你的心扉,那就向他(她)表白吧。"
dim youranswer
do
youranswer = inputbox(question, title)
if youranswer <> yourname then msgbox info, vbinformation+vbokonly, title
loop until youranswer = yourname
msgbox scend, vbinformation+vbokonly, title

Guess you like

Origin blog.csdn.net/yueyuedog/article/details/112389321