vbs小さなプログラムコレクション

1.コンピュータースピーキング
プログラム効果
コンピューターは「私を開いたのは豚だ」と言った。
コード

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

2.「私は豚です」
というプログラム効果「私は豚です」と
入力します。入力しないと、1分後にシャットダウンします。
コード

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.ラブテスト
プログラム効果
好きな人を入力し、「張さん」(文字列は変更可能)の場合はプログラムを停止します。そうでない場合、プログラムは無期限に実行されます。
コード

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

おすすめ

転載: blog.csdn.net/yueyuedog/article/details/112389321