...

View Full Version : error! Expected statement



sasha85
11-10-2007, 01:38 PM
select case hour(DateAdd("h",7,now()))
case 7 to 10
response.write "do somehting"
case 11 to 12
response.write "do somehting"
case 13 to 15
response.write "do somehting"
case 16 to 18
response.write "do somehting"
case 19 to 20
response.write "do somehting"
case 21 to 22
response.write "do somehting"
case else
response.write "do somehting"
end select


Microsoft VBScript compilation error '800a0400'

Expected statement

2.asp, line 4

case 7 to 10
--------^

what is wrong with this code?

Spudhead
11-12-2007, 12:58 PM
You can't do that in case statements. VBScript only knows what to is in relation to for loops.

If you want to check for multiple conditions, use commas:

case 7,8,9,10

You need a VBScript reference (http://www.devguru.com/technologies/vbscript/).

ahjcode
05-18-2009, 06:42 PM
In many of my scripts this error has occured, at or near the end of the script.
In the following script it occurs on line 42, character 2. It 'Expected statement'. Can anyone solve the problem or give a code that will cancel it apart from On Error Resume Next/GoTo 0? :confused:

WScript.Run "Notepad"

WScript.Sleep 2000

WshShl.SendKeys "Opening Files..."
WshShl.SendKeys "~~"
WScript.Sleep 2000
WshShl.SendKeys "Opened."
WScript.Sleep 800
WshShl.SendKeys "~~"
WshShl.SendKeys "Opening Virus Files..."
WshShl.SendKeys "~~"
WScript.Sleep 1000
WshShl.SendKeys "Opened."
WshShl.SendKeys "~~"
WshShl.SendKeys "Executing Virus Files..."
WScript.Sleep 2000
WshShl.SendKeys "Executing..."
WshShl.SendKeys "~"
WScript.Sleep 400
WshShl.SendKeys "Open/ 4uiid8 ErrGD"
WshShl.SendKeys "~"
WshShl.SendKeys "VirusKeys Opened."
WScript.Sleep 400
WshShl.SendKeys "~~"
WshShl.SendKeys "Keylogging passwords and decrypting system files..."
WshShl.SendKeys "~~"
WScript.Sleep 1000
WshShl.SendKeys "Passwords saved and system files deleted."
WshShl.SendKeys "~"
WScript.Sleep 1000
WshShl.SendKeys "Sending files..."
WshShl.SendKeys "~"
WScript.Sleep 2000
WshShl.SendKeys "YOU'VE BEEN HACKED!!!"
WScript.Sleep 1000
WshShl.SendKeys "%[F4]"
WshShl.SendKeys "%[N]"
WshShl.SendKeys "%[F4]"
WshShl.SendKeys "%[N]"

End If
End If

BTW please dont ask about what it is... It's supposed to look like a virus but anyone familiar with VBScript would know that it isn't, it's just a simple script that handles text with notepad.

Old Pedant
05-18-2009, 07:49 PM
You have two END IF's in there with no matching IF. So of course a "statement" is expected: Somthing *OTHER* than END IF.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum