Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Sep 2007
    Posts
    179
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Exclamation error! Expected statement

    Code:
    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?
    By the time u recognize this moment, This moment will be gone.

  • #2
    Senior Coder Spudhead's Avatar
    Join Date
    Jun 2002
    Location
    London, UK
    Posts
    1,856
    Thanks
    8
    Thanked 110 Times in 109 Posts
    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.

  • #3
    New to the CF scene
    Join Date
    May 2009
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question 'Expected Statement' Error

    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?

    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.

  • #4
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    26,027
    Thanks
    79
    Thanked 4,436 Times in 4,401 Posts
    You have two END IF's in there with no matching IF. So of course a "statement" is expected: Somthing *OTHER* than END IF.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •