Jump to content

Simple Problem


3rd
 Share

Recommended Posts

Hey yo, this is my 2nd day programming, so please be patient

func start();
    GUICreate("Good Night v1.0 by ^3rd",320,115)
    opt("GUICoordMode", 1)
    $Button_ = GUICtrlCreateButton("Start",110,40,100,30)
    $Input1 = GUICtrlCreateInput("Hours",10,10,100,30)
    $Input2 = GUICtrlCreateInput("Minutes",110,10,100,30)
    $Input3 = GUICtrlCreateInput("Seconds",210, 10, 100, 30)
    GUISetState()
    while not $Input1 > 0 or $Input2 > 0 or $Input3 > 0
        $msg2 = GUIGetMsg()
        Select
    Case $msg2 = $Button_
        MsgBox(0, "Good Night v1.0 by ^3rd", GUICTRLread($Input1)&" Hours "&GUICtrlRead($Input2)&" Minutes "&GUICtrlRead($Input3)&" Seconds"&@LF&"If this isn't correct, restart the program")
        GUISetState(@SW_HIDE)
    EndSelect
    wend
EndFunc

Hm, something is wrong with my "while xxx" I think, can u mb help me to fix it? It should simply read the Input (its doing it fine) and then just closing the GUI and go on with the next func.

Edit: well and it should only go on with the next func if the time is at least 1 second!

greetz,

3rd

Edited by 3rd
Link to comment
Share on other sites

Hi,

not $Input1 > 0 or $Input2 > 0 or $Input3 > 0

First of all you need to GuiCtrlRead the value from your controls otherwise you get the controlid itself back! Secondy, the term not ist strong that means your first comparison is (NOT Guictrl($input1)) > 0 which may not be what you want.

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

Hmm ^^ thanks for help so far, still cant handle it :\

if I understood everything correctly, I have to read the var's before checking if they are = 0 or w/e

func start();
    GUICreate("Good Night v1.0 by ^3rd",320,115)
    opt("GUICoordMode", 1)
    $Button_ = GUICtrlCreateButton("Start",110,40,100,30)
    $Input1 = GUICtrlCreateInput("Hours",10,10,100,30)
    $Input2 = GUICtrlCreateInput("Minutes",110,10,100,30)
    $Input3 = GUICtrlCreateInput("Seconds",210, 10, 100, 30)
    GUISetState()
    GUIctrlread($Input1);;; !!!! Reading the 3 var's
    GUICtrlRead($Input2)
    GUICtrlRead($Input3)
    while $Input1 = 0 and $Input2 = 0 and $Input3 = 0;;; !!!! checking if all of them are still 0
        $msg2 = GUIGetMsg()
        Select
    Case $msg2 = $Button_
        MsgBox(0, "Good Night v1.0 by ^3rd", GUICTRLread($Input1)&" Hours "&GUICtrlRead($Input2)&" Minutes "&GUICtrlRead($Input3)&" Seconds"&@LF&"If this isn't correct, restart the program")
        GUISetState(@SW_HIDE)
    EndSelect
    GUIctrlread($Input1);;;!!!!checking again, I think it have to be in the "loop" else it would just check it once in the beginning
    GUICtrlRead($Input2)
    GUICtrlRead($Input3)
    wend
EndFunc

hm, whats my problem? :)

Link to comment
Share on other sites

Hi,

you need something like this. It depends on your logic:

Func start();
    GUICreate("Good Night v1.0 by ^3rd", 320, 115)
    Opt("GUICoordMode", 1)
    $Button_ = GUICtrlCreateButton("Start", 110, 40, 100, 30)
    $Input1 = GUICtrlCreateInput("Hours", 10, 10, 100, 30)
    $Input2 = GUICtrlCreateInput("Minutes", 110, 10, 100, 30)
    $Input3 = GUICtrlCreateInput("Seconds", 210, 10, 100, 30)
    GUISetState()
    While not (GUICtrlRead($Input1) > 0 Or GUICtrlRead($Input2) > 0 Or GUICtrlRead($Input3) > 0)
        $msg2 = GUIGetMsg()
        Select
            Case $msg2 = $Button_
                MsgBox(0, "Good Night v1.0 by ^3rd", GUICtrlRead($Input1) & " Hours " & GUICtrlRead($Input2) & " Minutes " & GUICtrlRead($Input3) & " Seconds" & @LF & "If this isn't correct, restart the program")
                GUISetState(@SW_HIDE)
        EndSelect
    WEnd
EndFunc  ;==>start

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

How do I combine 'not' with '='?

while (GUICtrlRead($Input1) = 0 and GUICtrlRead($Input2) = 0 and GUICtrlRead($Input3) = 0 and GUICtrlRead($msg2) = not $Button_)

I want the "loop" to wait for button press

Link to comment
Share on other sites

Hi,

change the logic:

start()
Func start();
    GUICreate("Good Night v1.0 by ^3rd", 320, 115)
    Opt("GUICoordMode", 1)
    $Button_ = GUICtrlCreateButton("Start", 110, 40, 100, 30)
    $Input1 = GUICtrlCreateInput("Hours", 10, 10, 100, 30)
    $Input2 = GUICtrlCreateInput("Minutes", 110, 10, 100, 30)
    $Input3 = GUICtrlCreateInput("Seconds", 210, 10, 100, 30)
    GUISetState()
    While 1
        $msg2 = GUIGetMsg()
        Select
            Case $msg2 = $Button_
                If GUICtrlRead($Input1) > 0 Or GUICtrlRead($Input2) > 0 Or GUICtrlRead($Input3) > 0 Then 
                MsgBox(0, "Good Night v1.0 by ^3rd", GUICtrlRead($Input1) & " Hours " & GUICtrlRead($Input2) & " Minutes " & GUICtrlRead($Input3) & " Seconds" & @LF & "If this isn't correct, restart the program")
                GUISetState(@SW_HIDE)
            Else
               ; ...
            EndIf
        EndSelect
    WEnd
EndFunc  ;==>start

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

Just another question, sry if I am annoying ;>

func calc();
     $Input1 = $Input1 * 3600000;
 EndFunc

when I do this, $Input1 is 0 :\ Why?

Again if you want to deal with the value you have to use GuictrlRead!

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

Hi,

sag mal bemühen wir uns eigentlich mit Englisch? :)

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

Oo

Soll das jetzt heißen wieso wir Englisch schreiben, oder ob ich mir Mühe gebe (eine Anspielung auf mein schlechtes Englisch)?

edit:

GUICtrlSetData($time,GUICtrlRead($Input1) + GUICtrlRead($Input2) + GUICtrlRead($Input3))

grr ich dreh noch durch, wieso funzt das jetzt nicht -.-

Edited by 3rd
Link to comment
Share on other sites

Oo

Soll das jetzt heißen wieso wir Englisch schreiben, oder ob ich mir Mühe gebe (eine Anspielung auf mein schlechtes Englisch)?

edit:

GUICtrlSetData($time,GUICtrlRead($Input1) + GUICtrlRead($Input2) + GUICtrlRead($Input3))

grr ich dreh noch durch, wieso funzt das jetzt nicht -.-

Nein, ich hatte nur gesehen, dass du aus Ger kommst und da dachte ich ist es einfacher die Dinge in der Muttersprache zu klären. Es gibt auch ein deutsches Forum autoit.de .

Back to topic (in English) so others can understand what is going on here.

Post a description of what you want to achieve and of what your tried, afterwards we'll find a solution.

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

;D

Okay, simply I just want to have 3 InputBoxes (Already done) for Hours ($Input1), Minutes ($Input2), Seconds ($Input3), I calculate those in milliseconds

GUICtrlSetData($Input1,GUICtrlRead($Input1) * 3600000)
    GUICtrlSetData($Input2,GUICtrlRead($Input2) * 60000)
    GUICtrlSetData($Input3,GUICtrlRead($Input3) * 1000)

works perfect, and now I like to add those Numbers

GUICtrlSetData($time,GUICtrlRead($Input1) + GUICtrlRead($Input2) + GUICtrlRead($Input3))

and this isnt working :<

Edited by 3rd
Link to comment
Share on other sites

It is

start()
Func start();
    GUICreate("Good Night v1.0 by ^3rd", 320, 115)
    Opt("GUICoordMode", 1)
    $Button_ = GUICtrlCreateButton("Start", 110, 40, 100, 30)
    $Input1 = GUICtrlCreateInput("Hours", 10, 10, 100, 30)
    $Input2 = GUICtrlCreateInput("Minutes", 110, 10, 100, 30)
    $Input3 = GUICtrlCreateInput("Seconds", 210, 10, 100, 30)
    $time = GUICtrlCreateInput("Time", 10, 80, 200, 30)
    GUISetState()
    While 1
        $msg2 = GUIGetMsg()
        Select
            Case $msg2 = $Button_
                If GUICtrlRead($Input1) > 0 Or GUICtrlRead($Input2) > 0 Or GUICtrlRead($Input3) > 0 Then
                    GUICtrlSetData($time, GUICtrlRead($Input1) * 3600000 + GUICtrlRead($Input2) * 60000 + GUICtrlRead($Input3) * 1000)
                    MsgBox(0, "Good Night v1.0 by ^3rd", GUICtrlRead($Input1) & " Hours " & GUICtrlRead($Input2) & " Minutes " & GUICtrlRead($Input3) & " Seconds" & @LF & "If this isn't correct, restart the program")
                    GUISetState(@SW_HIDE)
                Else
                   ; ...
                EndIf
        EndSelect
    WEnd
EndFunc  ;==>start

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

func start();
    GUICreate("Good Night v1.0 by ^3rd",320,115)
    opt("GUICoordMode", 1)
    $Button_ = GUICtrlCreateButton("Start",110,40,100,30)
    $Input1 = GUICtrlCreateInput("0",10,10,100,30)
    $Input2 = GUICtrlCreateInput("0",110,10,100,30)
    $Input3 = GUICtrlCreateInput("0",210, 10, 100, 30)
    GUISetState()
    while 1
        $msg2 = GUIGetMsg()
        Select
    Case $msg2 = $Button_
        If GUICtrlRead($Input1) > 0 or GUICtrlRead($Input2) > 0 or GUICtrlRead($Input3) > 0 Then
        GUICtrlSetData($time, GUICtrlRead($Input1) * 3600000 + GUICtrlRead($Input2) * 60000 + GUICtrlRead($Input3) * 1000)
        GUISetState(@SW_HIDE)
        what()
    Else
        MsgBox(0, "Good Night v1.0 by ^3rd", "Please enter a time!")
        EndIf
    EndSelect
    wend
EndFunc

This my func, and the output of the time in ms is in "what()"

GUICtrlCreateLabel(GUICtrlRead($time)&" ms", 0, 0)

If i set "$time" to "$Input1" or 2 or 3, it shows me the single var, but "$time" is always 0 :\ dunno why

Edited by 3rd
Link to comment
Share on other sites

Come on, some1 tell me how to add var's!

Where did you create $time? Look at my example it works

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
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
 Share

  • Recently Browsing   0 members

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