First VBScript not working as expected [duplicate] - vbscript

I am at a complete loss here. I have been beating my head against a wall all weekend and I cannot for the life of me figure out how to make my program work. This is a college class assignment and it is my first programming assignment ever, so this is a real challenge for me. I have Googled until my fingers were bleeding (not really) and I have only come across marginally helpful information. Here is my assignment (I am deeply sorry if I get the formatting wrong):
'Initialization Section
Option Explicit
Const cGreetingMsg = "Pick a number between 1 - 100"
Dim intUserNumber, intRandomNo, strOkToEnd, intNoGuesses
intNoGuesses = 0
'Main Processing Section
'Generate a random number
Randomize
intRandomNo = FormatNumber(Int((100 * Rnd) + 1))
'Loop until either the user guesses correctly or the user clicks on Cancel
Do Until strOkToEnd = "yes"
'Prompt user to pick a number
intUserNumber = InputBox("Type your guess:",cGreetingMsg)
intNoGuesses = intNoGuesses + 1
'See if the user provided an answer
If Len(intUserNumber) <> 0 Then
'Make sure that the player typed a number
If IsNumeric(intUserNumber) = True Then
'Test to see if the user's guess was correct
If FormatNumber(intUserNumber) = intRandomNo Then
MsgBox "Congratulations! You guessed it. The number was " & _
intUserNumber & "." & vbCrLf & vbCrLf & "You guessed it " & _
"in " & intNoGuesses & " guesses.", ,cGreetingMsg
strOkToEnd = "yes"
End If
'Test to see if the user's guess was too low
'Assignment 3: Add another If/ElseIf/Else Condition to check for if the user is less than
'80,60,40,20,10 or farther from the correct guess, but still too low
If FormatNumber(intUserNumber) < intRandomNo Then
strOkToEnd = "no"
End If
'Test to see if the user's guess was too high
'Assignment 3: Add another If/ElseIf/Else Condition to check for if the user is more than
'80,60,40,20,10 or closer to the correct guess, but still too high
If FormatNumber(intUserNumber) > intRandomNo Then
strOkToEnd = "no"
End If
Else
MsgBox "Sorry. You did not enter a number. Try again.", , cGreetingMsg
End If
Else
MsgBox "You either failed to type a value or you clicked on Cancel. " & _
"Please play again soon!", , cGreetingMsg
strOkToEnd = "yes"
End If
Loop
This is blowing my mind. The only thing that has been remotely helpful has been this link: VBScript Guess a number and with that being said, I have no earthly idea how to even implement that code into my own. It looks like it would work, but whenever I try it VBScript throws tons of "expected end of statement" errors. My own code is near worthless in the effort, but here it is:
'Initialization Section
Option Explicit
Const cGreetingMsg = "Pick a number between 1 - 100"
Dim intUserNumber, intRandomNo, strOkToEnd, intNoGuesses
intNoGuesses = 0
'Main Processing Section
'Generate a random number
Randomize
intRandomNo = FormatNumber(Int((100 * Rnd) + 1))
'Loop until either the user guesses correctly or the user clicks on Cancel
Do Until strOkToEnd = "yes"
'Prompt user to pick a number
intUserNumber = InputBox("Type your guess:",cGreetingMsg)
intNoGuesses = intNoGuesses + 1
'See if the user provided an answer
If Len(intUserNumber) <> 0 Then
'Make sure that the player typed a number
If IsNumeric(intUserNumber) = True Then
'Test to see if the user's guess was correct
If FormatNumber(intUserNumber) = intRandomNo Then
MsgBox "Congratulations! You guessed it. The number was " & _
intUserNumber & "." & vbCrLf & vbCrLf & "You guessed it " & _
"in " & intNoGuesses & " guesses.", ,cGreetingMsg
strOkToEnd = "yes"
End If
'Test to see if the user's guess was too low
If FormatNumber(intUserNumber) < intRandomNo - 80 Then
MsgBox "Your guess was too low by 80. Try again", ,cGreetingMsg
ElseIf FormatNumber(intUserNumber) < intRandomNo - 60 Then
MsgBox "Your guess was too low by 60. Try again", ,cGreetingMsg
ElseIf FormatNumber(intUserNumber) < intRandomNo - 40 Then
MsgBox "Your guess was too low by 40. Try again", ,cGreetingMsg
ElseIf FormatNumber(intUserNumber) < intRandomNo - 20 Then
MsgBox "Your guess was too low by 20. Try again", ,cGreetingMsg
Elseif FormatNumber(intUserNumber) < intRandomNo - 10 Then
MsgBox "Your guess was too low by 10. Try again", ,cGreetingMsg
ElseIf FormatNumber(intUserNumber) > intRandomNo Then
MsgBox "Your guess was still too low. Try again, please", ,cGreetingMsg
strOkToEnd = "no"
End If
'Test to see if the user's guess was too high
If FormatNumber(intUserNumber) > intRandomNo - 80 Then
MsgBox "Your guess was too high by 80. Try again", ,cGreetingMsg
ElseIf FormatNumber(intUserNumber) > intRandomNo + 60 Then
MsgBox "Your guess was too high by 60. Try again", ,cGreetingMsg
ElseIf FormatNumber(intUserNumber) > intRandomNo + 40 Then
MsgBox "Your guess was too high by 40. Try again", ,cGreetingMsg
ElseIf FormatNumber(intUserNumber) > intRandomNo + 20 Then
MsgBox "Your guess was too high by 20. Try again", ,cGreetingMsg
ElseIf FormatNumber(intUserNumber) > intRandomNo + 10 Then
MsgBox "Your guess was too high by 10. Try again", ,cGreetingMsg
ElseIf FormatNumber(intUserNumber) < intRandomNo Then
MsgBox "Your guess was still too low. Try again, please", ,cGreetingMsg
strOkToEnd = "no"
End If
Else
MsgBox "Sorry. You did not enter a number. Try again.", , cGreetingMsg
End If
Else
MsgBox "You either failed to type a value or you clicked on Cancel. " & _
"Please play again soon!", , cGreetingMsg
strOkToEnd = "yes"
End If
Loop
Any and all help is greatly appreciated with this. Thank you.

Your main problem here is that all your numbers are really strings. The FormatNumber function takes a number and returns a string so intRandomNo is a string. InputBox also returns a string meaning intUserNumber is also a string. It will not be possible to calculate the difference if you keep those two values as strings. The first thing you have to do is to convert them to integers. I will not write all the code for you but I will give you a hint. First declare this variable:
Dim Difference
Then assign it this value inside your loop:
Difference = CInt(intRandomNo) - CInt(intUserNumber)
... and use that variable in your nested if. It should be easy after that.

'Initialization Section
Option Explicit
Const cGreetingMsg = "Pick a number between 1 - 100"
Dim intUserNumber, intRandomNo, strOkToEnd, intNoGuesses, stringToNumber
intNoGuesses = 0
'Main Processing Section
'Generate a random number
Randomize
intRandomNo = FormatNumber(Int((100 * Rnd) + 1))
'Loop until either the user guesses correctly or the user clicks on Cancel
Do Until strOkToEnd = "yes"
'Prompt user to pick a number
intUserNumber = InputBox("Type your guess:",cGreetingMsg)
intNoGuesses = intNoGuesses + 1
'See if the user provided an answer
If Len(intUserNumber) <> 0 Then
'Make sure that the player typed a number
If IsNumeric(intUserNumber) = True Then
'Test to see if the user's guess was correct
If FormatNumber(intUserNumber) = intRandomNo Then
MsgBox "Congratulations! You guessed it. The number was " & _
intUserNumber & "." & vbCrLf & vbCrLf & "You guessed it " & _
"in " & intNoGuesses & " guesses.", ,cGreetingMsg
strOkToEnd = "yes"
End If
'Test to see if the user's guess was too low
'Assignment 3: Add another If/ElseIf/Else Condition to check for if the user is less than
'80,60,40,20,10 or farther from the correct guess, but still too low
If FormatNumber(intUserNumber) < intRandomNo Then
MsgBox "The number you chose is too low", ,cGreetingMsg
strOkToEnd = "no"
End If
If FormatNumber(intRandomNo) - intUserNumber = 10 Then
MsgBox "Too low 10 off!", ,cGreetingMsg
ElseIf FormatNumber(intRandomNo) - intUserNumber = 20 Then
MsgBox "Too low 20 off!", ,cGreetingMsg
ElseIf FormatNumber(intRandomNo) - intUserNumber = 40 Then
MsgBox "Too low 40 off!", ,cGreetingMsg
ElseIf FormatNumber(intRandomNo) - intUserNumber = 60 Then
MsgBox "Too low 60 off!", ,cGreetingMsg
ElseIf FormatNumber(intRandomNo) - intUserNumber = 80 Then
MsgBox "Too low 80 off!", ,cGreetingMsg
strOkToEnd = "no"
End If
If FormatNumber(intUserNumber) > intRandomNo Then
MsgBox "The number you chose is too high!", ,cGreetingMsg
strOkToEnd = "no"
End If
'Test to see if the user's guess was too high
'Assignment 3: Add another If/ElseIf/Else Condition to check for if the user is more than
'80,60,40,20,10 or closer to the correct guess, but still too high
If FormatNumber(intUserNumber) - intRandomNo = 10 Then
MsgBox "Too high 10 off!", ,cGreetingMsg
ElseIf FormatNumber(intUserNumber) - intRandomNo = 20 Then
MsgBox "Too high 20 off!", ,cGreetingMsg
ElseIf FormatNumber(intUserNumber) - intRandomNo = 40 Then
MsgBox "Too high 40 off!", ,cGreetingMsg
ElseIf FormatNumber(intUserNumber) - intRandomNo = 60 Then
MsgBox "Too high 60 off!", ,cGreetingMsg
ElseIf FormatNumber(intUserNumber) - intRandomNo = 80 Then
MsgBox "Too high 80 off!", ,cGreetingMsg
strOkToEnd = "no"
End If
Else
MsgBox "Sorry. You did not enter a number. Try again.", , cGreetingMsg
End If
Else
MsgBox "You either failed to type a value or you clicked on Cancel. " & _
"Please play again soon!", , cGreetingMsg
strOkToEnd = "yes"
End If
Loop

Related

VBScript Guess a number

So I am at a bit of a loss. I have been working on this script for a "Guess a Number" game for a class and so far I have been successful. Now the assignment requires that when the user guesses either too high or too low it should give them better clues as to how far away they are.
If, for example, the user is 50 numbers away it should notify them they are cold. If they are 30 numbers away they are warm, 10 numbers away they are hot...
I can't figure that part out.
Any help is greatly appreciated.
Initialization Section
Option Explicit
Const cGreetingMsg = "Pick a number between 1 - 100"
Dim intUserNumber, intRandomNo, strOkToEnd, intNoGuesses
intNoGuesses = 0
'Main Processing Section
'Generate a random number
Randomize
intRandomNo = FormatNumber(Int((100 * Rnd) + 1))
'Loop until either the user guesses correctly or the user clicks on Cancel
Do Until strOkToEnd = "yes"
'Prompt user to pick a number
intUserNumber = InputBox("Type your guess:",cGreetingMsg)
intNoGuesses = intNoGuesses + 1
'See if the user provided an answer
If Len(intUserNumber) <> 0 Then
'Make sure that the player typed a number
If IsNumeric(intUserNumber) = True Then
'Test to see if the user's guess was correct
If FormatNumber(intUserNumber) = intRandomNo Then
MsgBox "Congratulations! You guessed it. The number was " & _
intUserNumber & "." & vbCrLf & vbCrLf & "You guessed it " & _
"in " & intNoGuesses & " guesses.", ,cGreetingMsg
strOkToEnd = "yes"
End If
'Test to see if the user's guess was too low
If FormatNumber(intUserNumber) < intRandomNo Then
MsgBox "Your guess was too low. Try again", ,cGreetingMsg
strOkToEnd = "no"
End If
'Test to see if the user's guess was too high
If FormatNumber(intUserNumber) > intRandomNo Then
MsgBox "Your guess was too high. Try again", ,cGreetingMsg
strOkToEnd = "no"
End If
Else
MsgBox "Sorry. You did not enter a number. Try again.", , cGreetingMsg
End If
Else
MsgBox "You either failed to type a value or you clicked on Cancel. " & _
"Please play again soon!", , cGreetingMsg
strOkToEnd = "yes"
End If
Loop
Your question is probably off topic for S.O. I will give you a hint anyway because I have been in your shoes once...
Does this ring a bell on?
coldThresHold = 20
If userNumber = intRandomNo + coldThresHold Then YouGuessed()
Else If userNumber > intRandomNo + coldThresHold Then YouAreCold()
Else If userNumber > intRandomNo Then YouAreHot()
Else If userNumber < intRandomNo - coldThresHold Then YouAreCold()
Else userNumber < intRandomNo Then YouAreHot()

Error Checking With VBScript Err Object

With the following block of code, which accesses an html span element, I am unable to check for errors. When I leave the input box empty and press "ok," the value of Err.Number doesn't change. I have user error checking enabled (On Error Resume Next) and I am checking to make sure that Err.Number is not equal to 0 (an error is ocurring). The error is being thrown, but the value of Err.Number is not changing, and this happens both when On Error Resume Next is on as well as when it is off). By the way, what is the default value of Err.Number? How does that value differ from the value of Err.Number after the Err object is cleared? If I am doing anything wrong or stating any wrong information, please inform me.
On Error Resume Next
Dim updateRate
updateRate = 0
RatePrompt()
Sub RatePrompt
updateRate = InputBox("Please enter an update rate (milliseconds)", "Update Rate")
If Err <> 0 Then
Err.Clear()
MsgBox "No Input Was Specified. Please Specify An Input."
RatePrompt()
Else If updateRate > 2000 then
rateDecision = MsgBox ("Consider entering a lower update rate" & vbCrLf & "Would you like to revise update rate?", _
vbYesNo, "Quiclock Alert")
If rateDecision = vbYes then
RatePrompt()
End If
Else If updateRate < 0 then
MsgBox "Update Rate Not Valid. The Default Value of 0 Milliseconds Will Be Used."
updateRate = 0
Else If updateRate = "" then
MsgBox "Update Rate Adjustment Cancelled. The Default Value of 0 Milliseconds Will Be Used."
updateRate = 0
Else
End If
End If
End If
End If
End Sub
TimerStart()
Sub TimerStart
timerID = window.setTimeout("TimeUpdate", updateRate, "VBScript")
End Sub
Sub TimeUpdate
clockOutput.innerHTML = Time()
window.clearTimeout(timerID)
TimerStart()
End Sub
I have spent a large amount of time researching this problem, but have not come to a conclusion. Thanks for the help.
Try next logic skelet for your script:
Dim updateRate, rateRevision
updateRate = InputBox("Please enter an update rate (milliseconds)", "Update Rate")
If IsEmpty( updateRate) Then
'`Cancel` (or equivalent `Esc` or red `×`) pressed/clicked
Else
If IsNumeric( updateRate) Then
updateRate = CLng( updateRate) 'convert string to a Variant of subtype Long
If updateRate > 2000 Then
' do not bother a user by an additional input: offer a value change right now
rateRevision = InputBox ("Consider entering a lower update rate" _
& vbCrLf & "Would you like to revise update rate?", _
"Quiclock Alert", updateRate)
If IsNumeric( rateRevision) Then
rateRevision = CLng( rateRevision)
If rateRevision > 0 Then updateRate = rateRevision
Else
' keep the value > 2000
End If
ElseIf updateRate < 0 Then
updateRate = 0
Else
''
End If
Else
'non-numeric input, use e.g. default value of zero
updateRate = 0
End If
TimerStart()
End If
An explanation and observation to the code:
There is a mistake in the InputBox Function reference. In fact: if the user clicks Cancel (or the red × or presses Esc), then the function returns an empty value, which looks like a zero-length string ("") due to automatic subtype conversion. See the 32213674.vbs script output below.
Comparison Operators (VBScript) reference shows how expressions are compared or what results from the comparison, depending on the underlying subtype; particularly: if one expression is numeric and the other is a string then the numeric expression is less than the string expression.
32213674.vbs script:
option explicit
On Error GoTo 0
Dim sValInput
Call doOutput( True, sValInput)
Do While True
sValInput = InputBox( _
"Please enter any value (and `OK`) to see its features:" & vbCR _
& "a date-like value, e.g. " & FormatDateTime( Now, vbShortDate) & vbCR _
& "a time-like value, e.g. " & FormatDateTime( Now, vbShortTime) & vbCR _
& "a number-like value, e.g. 123456" & vbCR _
& "a string of your choice" & vbCR _
& "an empty string (i.e. only click `OK`)" & vbCR _
& "or press `Esc` or click red `×` or `Cancel` button to exit the loop" _
, "InputBox test loop")
Call doOutput( False, sValInput)
If IsEmpty( sValInput) Then Exit Do
Loop
Sub doOutput( bHeader, sVal)
If Instr(1, Wscript.FullName, "cscript.exe", vbTextCompare) > 0 Then
If bHeader Then
Wscript.Echo sHead()
Else
Wscript.Echo sLine( sVal)
End If
Else
If bHeader Then
Else
MsgBox( sHead() & vbCR & sLine( sVal))
End If
End If
End Sub
Function sHead()
sHead = "Empty?" & vbTab & "Number?" & vbTab & _
"Date?" & vbTab & "VarType" & vbTab & "TypeName" & "[value]"
End Function
Function sLine( sValue)
sLine = IsEmpty( sValue) & vbTab & IsNumeric( sValue) & vbTab & _
IsDate( sValue) & vbTab & VarType( sValue) & vbTab & _
TypeName( sValue) & vbTab & "[" & sValue & "]"
End Function
Output:
==>cscript //NOLOGO D:\VB_scripts\SO\32213674.vbs
Empty? Number? Date? VarType TypeName[value]
False False True 8 String [2015-08-26]
False False True 8 String [22:01:05]
False True False 8 String [123456]
False False False 8 String [qwertz]
False False False 8 String []
True True False 0 Empty []

VbScript make computer say something error

I have this file that makes a computer say something. I want it to loop with a VbCancel function. I get this error. Code so far:
Do
Dim Message, Speak
Message=InputBox("Enter text","Speak")
Set Speak=CreateObject("sapi.spvoice")
MsgBox ("You entered: " & Speak)
Speak.Speak Message
If Len(Speak) = 0 Then
MyMessageBox = MsgBox("Click Yes if you mean to Cancel." & vbCrLf & _
"If you mean to enter a zero length string, click No.", vbYesNo, "DO YOU MEAN TO CANCEL?")
If MyMessageBox = vbYes Then
MsgBox "Operation Cancelled"
Exit Sub
End If
Loop
BTW the error is Invalid exit statement
I'm working on Windows 7
Dim Message, Speak
Do
Message=InputBox("Enter text","Speak")
Set Speak=CreateObject("sapi.spvoice")
MsgBox ("You entered: " & Message)
Speak.Speak Message
If Len(Message) = 0 Then
MyMessageBox = MsgBox("Click Yes if you mean to Cancel." & vbCrLf & _
"If you mean to enter a zero length string, click No.", vbYesNo, "DO YOU MEAN TO CANCEL?")
If MyMessageBox = vbYes Then
MsgBox "Operation Cancelled"
Exit Do
End If
End If
Loop
You had several issues here
Exit Sub is for subroutines. You were trying to exit a Do loop
Speak is an object. I dont know if it has a string property but it is not itself a string. Both Len(Speak) and "You entered: " & Speak has Speak changed to Message.
You were missing an End If
I moved the Dim statements out of the loop. No point recreating the object over and over again.
Dim Message, Speak
Do
Message=InputBox("Enter text","Speak")
Set Speak=CreateObject("sapi.spvoice")
MsgBox ("You entered: " & Message)
Speak.Speak Message
If Len(Message) = 0 Then
MyMessageBox = MsgBox("Click Yes if you mean to Cancel." & vbCrLf & _
"If you mean to enter a zero length string, click No.", vbYesNo, "DO YOU MEAN TO CANCEL?")
If MyMessageBox = vbYes Then
MsgBox "Operation Cancelled"
Exit Do
End If
End If
Loop

I need some idea to correct this VBS code

Hello everyone.
Hope everyone is fine.
I need help with this code below with the section (comment line) saying "'Help needed from here'":
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_LocalTime")
For Each objItem in colItems
MsgBox "Welcome to the ALARM tool",0+0,"ALARM tool"
MsgBox "Note: 1) If the computer is given a shutdown or a restart command then the alarm will be disabled. 2) This ALARM tool dosen't support decimals & words. If you will enter a decimal, the elapsed message box will appear without processing the alarm due to the error. If you enter words then an error message will appear.",0+0,"ALARM tool"
thour=InputBox ("Type which hour you want the alarm to elapse in 24-hour format from 0 to 23 inclusive (not 24; instead 0): (E.G: 19, 15)","ALARM tool")
If thour="" Then
MsgBox "The value is empty, so no alarm is set.",16,"ALARM tool"
WScript.Quit
End If
tmin=InputBox ("Type which minute you want the alarm to elapse from 0 to 60 inclusive:","ALARM tool")
If tmin="" Then
MsgBox "The value is empty, so no alarm is set.",16,"ALARM tool"
WScript.Quit
End If
c=InputBox ("Enter your comment; leave it blank if you don't want one:","ALARM tool")
If c="" Then
MsgBox "Time: ''"+thour+":"+tmin+"'' Comment: None",0,"ALARM tool: Preview"
Else
MsgBox "Time: ''"+thour+":"+tmin+"'' Comment: ''"+c+"''",0,"ALARM tool: Preview"
End If
co=MsgBox ("Are you sure?",36,"ALARM tool")
If co="7" Then
MsgBox "Alarm cancelled!!!",0,"ALARM tool"
WScript.Quit
End If
'Help needed from here'
Do
If thour=objItem.Hour Then
If tmin=objItem.Minute Then
If c="" Then
MsgBox "ALARM set to elapse on "+thour+":"+tmin+" has elapsed!!!",0+0,"ALARM set to elapse in "+t
WScript.Quit
Else
MsgBox c,0+0,"ALARM set to elapse in "+t
WScript.Quit
End If
End If
End If
'No more help needed after this'
If Err.Number <> 0 Then
MsgBox "There's an error while setting the alarm. Maybe you typed words or it's an internal error. Please try again. Sorry for the inconvenience.",0,"ALARM tool"
WScript.Quit
End If
Loop
Next
You can give me the answer while even use it for yourself.Topic: Alarm for specific timeI will say thanks for helping me and it will be a very good help.

How to make a vbs spam bot?

I'm trying to make a spam bot, the basic function works fine but the counter isn't. It should go from and imputed number [i] and stop at another [count] and if count < i; it should count backwards. But it is not stopping at count, it keeps going, It won't count backwards either.
set shl = createobject("wscript.shell")
spam = inputbox("What do you want to spam?")
if spam = "/count" then
i = inputbox("Start at what number?")
count = inputbox("Stop at what number?")
wscript.sleep 2500
if count > i then
do while count > i
shl.sendkeys i
wscript.sleep 10
shl.sendkeys "{ENTER}"
wscript.sleep 10
i = i + 1
loop
elseif count < i then
do while count < i
shl.sendkeys i
wscript.sleep 10
shl.sendkeys "{ENTER}"
wscript.sleep 10
i = i - 1
loop
else
shl.sendkeys i
end if
end if
else
count = inputbox("How many times?")
wscript.sleep 2500
do while count > 0
shl.sendkeys spam
wscript.sleep 10
shl.sendkeys "{ENTER}"
wscript.sleep 10
count = count - 1
loop
end if
I'm also going to make a function where you can send multiple lines. Any other ideas?
set shell = createobject ("wscript.shell")
strtext = inputbox ("Write down your message you like to spam")
strtext2 = inputbox ("Message 2")
strtext3 = inputbox ("Message 3")
strtext4 = inputbox ("Message 4")
strtext5 = inputbox ("Message 5")
strtimes = inputbox ("How many times do you like to spam? Type in 1 less than the amount of msgs you want to spam. eg; if want to spam 1000, type 999.Max no.1999")
strspeed = inputbox ("Type 1000 for 1 msg per second 100 for 10 msg per second etc type 1 for fastest")
strtimeneed = inputbox ("How many SECONDS do you need to get to your victims input box? Click where you want to spam.")
If not isnumeric (strtimes & strspeed & strtimeneed) then
msgbox "You entered something else then a number on Times, Speed and/or Time need. shutting down"
wscript.quit
End If
strtimeneed2 = strtimeneed * 1000
do
msgbox "You have " & strtimeneed & " seconds to get to your input area where you are going to spam."
wscript.sleep strtimeneed2
for i=0 to strtimes
shell.sendkeys (strtext & "{enter}")
shell.sendkeys (strtext2 & "{enter}")
shell.sendkeys (strtext3 & "{enter}")
shell.sendkeys (strtext4 & "{enter}")
shell.sendkeys (strtext5 & "{enter}")
wscript.sleep strspeed
Next
wscript.sleep strspeed * strtimes / 10
returnvalue=MsgBox ("Want to spam again?",36)
If returnvalue=6 Then
End If
If returnvalue=7 Then
msgbox "Spambox is shutting down"
wscript.quit
End IF
strtext = inputbox ("Write down your message you like to spam")
strtimes = inputbox ("How many times do you like to spam? Type in 1 less than the amount of msgs you want to spam. eg; if want to spam 1000, type 999")
strspeed = inputbox ("Type 1000 for 1 msg per second 100 for 10 msg per second etc type 1 for fastest")
strtimeneed = inputbox ("How many SECONDS do you need to get to your victims input box? Click where you want to spam")
loop
This is my edit of a code I found online that allows for multiple lines
I think on the countdown you put else if, instead of Elseif, i have also changed some of the indentation to make it easier to read

Resources