我试图弄清楚如何使用.vbs只使用一个条件来发生多个事件.(这里我尝试使用case语句.)是否有这样的命令,或者我是否必须为每一行重写命令?(这可以通过在之前的代码行中激活它来在记事本上输入.)
msgbox("I was woundering how old you are.")
age=inputbox("Type age here.",,"")
Select Case age
Case age>24
x=age-24
WshShell.SendKeys "I see you are "&x&" years older than me."
WshShell.SendKeys "{ENTER}"
Case age<24
x=24-age
WshShell.SendKeys "I see you are "&x&" years younger than me."
WshShell.SendKeys "{ENTER}"
Case age=24
WshShell.SendKeys "Wow were the same age!"
WshShell.SendKeys "{ENTER} "
End Select
Run Code Online (Sandbox Code Playgroud)