Jump to content

Recommended Posts

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
Posted

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...

Posted

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

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
Posted

$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

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...