WshShell.SendKeys - SLASH not allowed?

753 views Asked by At

Today I am having difficulties with this following code:

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"

It is supposed to message a player in Minecraft this song, but this code is faulty. I have not done VBScript since last year, so this will be hard. Is / not allowed or is there a little typo?

1

There are 1 answers

0
JosefZ On BEST ANSWER

Reading Windows Script Host SendKeys Method docs, all your characters are allowed except an unknown user's input.

However, set WshShell = WScript.CreateObject("WScript.Shell") missing in you code...

Consider testing it with notepad instead of Minecraft: all the code snippet outputs all in one line.