Sign in to follow this  
Followers 0
Gif

Mistake?

6 posts in this topic

#1 ·  Posted (edited)

Case $msg = $btn_shutdown

If StringIsAlpha($in_serekalointa) Then

MsgBox(16, "Numbers Only!", "Please enter numbers only.")

ElseIf $in_serekalointa<0 Then

MsgBox(0, "Error", "Error in the time, try again")

ElseIf $in_serekalointa>0 And $in_serekalointa<100000000 And Not StringIsAlpha($in_serekalointa) Then

Sleep($in_serekalointa * 1000)

Shutdown(1)

EndIf

Cant Find THe Mistake Please Help Me

Edited by c4nm7

Share this post


Link to post
Share on other sites



would help if you say what the problem is ..... :)

... Does not works, i insert letters in the input box and it still accepts them , while it does not functions properly, it is suppost to shutdown the pc in the time specified but it does not...

Share this post


Link to post
Share on other sites

maybe..

you should/need to read the info

Case $msg = $btn_shutdown
    $in_serekalointa = "2" ;GUICtrlRead($THE_INPUT_INFO)
    If StringIsAlpha($in_serekalointa) Then
        MsgBox(16, "Numbers Only!", "Please enter numbers only.")
    ElseIf $in_serekalointa < 0 Then
        MsgBox(0, "Error", "Error in the time, try again")
    ElseIf $in_serekalointa > 0 And $in_serekalointa < 100000000 And Not StringIsAlpha($in_serekalointa) Then
        Sleep($in_serekalointa * 1000)
        MsgBox(0,0,"shutdown", 1)
        ;Shutdown(1)
    EndIf

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

I notice you are mixing string and numeric comparisons. Be sure you understand the difference between 0 and "0".

Maybe:

Case $msg = $btn_shutdown
    If Not StringIsInt($in_serekalointa) Then
        MsgBox(16, "Whole numbers Only!", "Please enter whole numbers only.")
    Else
        $in_serekalointa = Number($in_serekalointa)
        If $in_serekalointa < 0 Then
            MsgBox(0, "Error", "Error in the time, try again")
        ElseIf $in_serekalointa > 0 And $in_serekalointa < 100000000 And Not StringIsAlpha($in_serekalointa) Then
            Sleep($in_serekalointa * 1000)
            Shutdown(1)
        EndIf
    EndIf

:)

Edited by PsaltyDS

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

$input="lol"
$text = "Time in seconds to shutdown your pc"

while 1
    $input=InputBox("Shutdown time" , $text)
    $input=Dec(Hex($input))
    If @error=1 Then
        Exit
    EndIf
    Sleep(10)
    If IsNumber($input)=1 And $input<>0 Then
        Sleep($input)
        Shutdown(9)
        Exit
    EndIf
    $text="Time in seconds to shutdown your pc"&@CRLF&@CRLF&@CRLF&"        The input was incorrect!"    
WEnd

this works :)


Only two things are infinite, the universe and human stupidity, and i'm not sure about the former -Alber EinsteinPractice makes perfect! but nobody's perfect so why practice at all?http://forum.ambrozie.ro

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0