none
Time function doesnt work correctly RRS feed

  • Question

  • Hello Guys, Im a newbie to the scripting world and somehow I can't figure this out with all the things that are already on the internet.

     

    I need a simple peace of code that execute a certain key command everyday on the same time.

    Basically it works the only problem I have is that it keeps repeating itself because of the fact that I have put in "If time is >". But if I replace the > with = it won't execute anymore.

    Also I have tried to extend the pause time after the last command with 14 hours but then wont execute the next day.


    $LANG = "VBScript"
    ' VBS script learned for "Klimaat.HAW" on 02/04/18 at 11:29:26.
    
    cr = Chr(13)
    
    haAbortOnError
    
    
    while haGetConnectionStatus = 1
    If Time() > TimeValue("10:00") then
    
    	haTypeText Chr(2)
    
    	haWaitForPrompt Chr(255)&"0#"
    	haTypeText "dk 131"& cr
    
    	haWaitForPrompt "      0="
    	haTypeText "300/"
    	haWaitForPrompt "      0="
    	haTypeText "300/"
    	haWaitForPrompt "      0="
    	haTypeText "200/"
    	haWaitForPrompt "      0="
    	haTypeText "200/"
    
    	haWaitForPrompt "    0.0="
    	haTypeText Chr(27)
    	haWait 600000
    else
    	haWait 10000
    end if
    
    wend
    
    haTerminate



    • Moved by Bill_Stewart Monday, March 12, 2018 9:31 PM Unanswerable drive-by question
    Wednesday, February 7, 2018 12:55 PM

All replies

  • This "$LANG = "VBScript" is not legal in VBScript.


    \_(ツ)_/

    Wednesday, February 7, 2018 1:08 PM
  • This will be true for any time from 10:00 AM until 12:00 AM'

    IfTime() >TimeValue("10:00") then

    If that is not what you want you will have to code it for what you want.


    \_(ツ)_/

    Wednesday, February 7, 2018 1:11 PM