今天我遇到以下代码遇到了困难:
x=msgbox("Your Text Here" ,0, "Your Title Here")
UserName=inputbox("After this message, you have 5 seconds to switch to Minecraft. Please enter the username you wish to type the song to:")
wscript.sleep 5000
WshShell.SendKeys "/msg" + UserName + "I know that we just met maybe this is dumb but it feels like there was something from the moment"
wscript.sleep 1000
WshShell.SendKeys "/msg" + UserName + "that we touched 'Cause, it's alright, it's alright I wanna make you mine The way you're lightin'"
wscript.sleep 1000
WshShell.SendKeys "/msg" + UserName + "up the room Caught the corner of my eye We can both sneak out the back door We don't have to say"
wscript.sleep 1000
WshShell.SendKeys "/msg" + UserName + "goodbye 'Cause, it's alright, it's alright To waste time tonight Maybe I'm just a kid in love"
wscript.sleep 1000
WshShell.SendKeys "/msg" + UserName + "Maybe I'm just a kid in love Oh, baby If this is what it's like falling in love Then I don't ever"
wscript.sleep 1000
WshShell.SendKeys "/msg" + UserName + "wanna grow up Maybe I'm just a kid in love Maybe I'm just a kid in love Oh, baby"
wscript.sleep 1000
WshShell.SendKeys "/msg" + UserName + "It'd be cool if it's the two of us But I don't ever wanna grow up 'Cause I got it all"
wscript.sleep 1000
WshShell.SendKeys "/msg" + UserName + "Oh, oh, oh, oh, oh, oh And I got it all And I don't ever wanna grow up"
wscript.sleep 1000
WshShell.SendKeys "/msg" + UserName + "Said, your place is kinda close And your 'Rents are out of town Baby, there's no pressure"
wscript.sleep 1000
WshShell.SendKeys "/msg" + UserName + "But if you're down, I'm down 'Cause, it's alright, it's alright To just talk tonight"
wscript.sleep 1000
WshShell.SendKeys "/msg" + UserName + "If you're feeling kinda crazy Turn down the lights We can take our time Do whatever you like"
wscript.sleep 1000
WshShell.SendKeys "/msg" + UserName + "It's alright, it's alright I wanna make you mine Maybe I'm just a kid in love"
wscript.sleep 1000
WshShell.SendKeys "/msg" + UserName + "Maybe I'm just a kid in love Oh, baby If this is what it's like falling in love"
wscript.sleep 1000
WshShell.SendKeys "/msg" + UserName + "Then I don't ever wanna grow up Maybe I'm just a kid in love Maybe I'm just a kid in love"
wscript.sleep 1000
WshShell.SendKeys "/msg" + UserName + "Oh, baby It'd be fine if it's the two of us But I don't ever wanna grow up"
wscript.sleep 1000
WshShell.SendKeys "/msg" + UserName + "'Cause I got it all Oh, oh, oh, oh, oh, oh And I got it all And I don't ever wanna grow up"
wscript.sleep 1000
WshShell.SendKeys "/msg" + UserName + "'Cause I got it all Oh, oh, oh, oh, oh, oh And I got it all And I don't ever wanna grow up"
wscript.sleep 1000
WshShell.SendKeys "/msg" + UserName + "You make me feel like I got it all, yeah And you make me feel Like I'm just a kid in love"
wscript.sleep 1000
WshShell.SendKeys "/msg" + UserName + "And you make me feel like I got it all And you make me feel like I don't ever wanna grow up"
wscript.sleep 1000
WshShell.SendKeys "/msg" + UserName + "Maybe we're just kids in love Maybe we're just kids in love Oh baby If this is what it's like"
wscript.sleep 1000
WshShell.SendKeys "/msg" + UserName + "falling in love Then we don't ever have to grow up Maybe we're just kids in love"
wscript.sleep 1000
WshShell.SendKeys "/msg" + UserName + "Maybe we're just kids in love Oh baby When we're alone and it's the two of us"
wscript.sleep 1000
WshShell.SendKeys "/msg" + UserName + "I can't get enough I've got it all, yeah I've got it all, yeah"
wscript.sleep 1000
WshShell.SendKeys "/msg" + UserName + "And I've got it, and I've got it all And I've got it, and we've got it all And I've got it,"
wscript.sleep 1000
WshShell.SendKeys "/msg" + UserName + "and I've got it all But I don't ever wanna grow up"
wscript.sleep 1000
WshShell.SendKeys "/msg" + UserName + "Song: Kid In Love | By Shawn Mendes"
wscript.sleep 1000
WshShell.SendKeys "/msg" + UserName + "Sent by MineMessage (R) - By kittens643"
应该在Minecraft中给这位歌曲的玩家留言,但这段代码有问题。自去年以来我没有做过VBScript,所以这很难。是/
是不允许的还是有点错字?
答案 0 :(得分:1)
阅读Windows Script Host SendKeys
Method个文档,除了未知用户的输入外,其他所有字符都是允许的。
但是,代码中缺少set WshShell = WScript.CreateObject("WScript.Shell")
...
考虑使用notepad
代替Minecraft
对其进行测试:所有代码段都在一行中输出。