Sign in to follow this  
Followers 0
3rd

Simple Problem

19 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
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

Share this post


Link to post
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? :)

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Oh my god, it works ^^ But now Ive the problem that the Window is closing immediately after entering a number ;D But I think I can handle it somehow, thanks !!!

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Working perfectly, its much more clever this way, my brain is way too small for this shit, nvm... ty for help <3

Share this post


Link to post
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?

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

GUICtrlSetData($Input1,GUICtrlRead($Input1) * 3600000)

k, got it

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

#15 ·  Posted (edited)

;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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

#17 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
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

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