Alexxander Posted August 27, 2013 Share Posted August 27, 2013 hi all what i'm trying to accomplish is a small script that give a msgbox when the clock time equals the time the user provide in the GUI but it won't work until the user press the button here is what i tried #include <GUIConstantsEx.au3> #include <DateTimeConstants.au3> #include <date.au3> GUICreate("My GUI get date", 200, 200, 800, 200) $date = GUICtrlCreateDate("", 10, 10, 185, 20) $button = GUICtrlCreateButton("", 50, 50, 100, 50) ; to select a specific default format $DTM_SETFORMAT_ = 0x1032 ; $DTM_SETFORMATW $style = "M/d/yyyy hh:mm:ss tt" GUICtrlSendMsg($date, $DTM_SETFORMAT_, 0, $style) GUISetState() While 1 $nMsg = GUIGetMsg() If $nMsg = $GUI_EVENT_CLOSE Then Exit if $nMsg = $button then but() WEnd func but() do Sleep (1000) Until _Now() = GUICtrlRead($date) MsgBox(0, "", "matched") EndFunc any ideas why this wont work for me ? Link to comment Share on other sites More sharing options...
Moderators Solution Melba23 Posted August 27, 2013 Moderators Solution Share Posted August 27, 2013 alexander95, any ideas why this wont work for me ?Yes. Try adding these 2 lines and see if you can see it as well: func but() ConsoleWrite(GUICtrlRead($date) & @CRLF) ConsoleWrite(_Now() & @CRLF) do Sleep (1000) Until _Now() = GUICtrlRead($date) MsgBox(0, "", "matched") EndFuncDid the light bulb illuminate? M23 Alexxander 1 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Alexxander Posted August 27, 2013 Author Share Posted August 27, 2013 alexander95, Yes. Try adding these 2 lines and see if you can see it as well: func but() ConsoleWrite(GUICtrlRead($date) & @CRLF) ConsoleWrite(_Now() & @CRLF) do Sleep (1000) Until _Now() = GUICtrlRead($date) MsgBox(0, "", "matched") EndFunc Did the light bulb illuminate? M23 thank you bro i'm so idiot i hope i'm not reducing this forum level Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted August 27, 2013 Moderators Share Posted August 27, 2013 alexander95,Rather than feeling sorry for yourself, learn from the above and try some basic errorchecking yourself before posting next time. For example, if you have a comparison that is not working, make sure that you are comparing things which are alike - if a file operation does not work, check the path that you are passing to it. etc, etc. It is experience that suggests where to look to find problems - so build up your own experience level, simple really. M23 Alexxander 1 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
michaelslamet Posted August 27, 2013 Share Posted August 27, 2013 This is work as expected for your project: #include <GUIConstantsEx.au3> #include <DateTimeConstants.au3> #include <date.au3> GUICreate("My GUI get date", 200, 200, 800, 200) $date = GUICtrlCreateDate("", 10, 10, 185, 20) $button = GUICtrlCreateButton("", 50, 50, 100, 50) ; to select a specific default format $DTM_SETFORMAT_ = 0x1032 ; $DTM_SETFORMATW $style = "yyyy/MM/d HH:mm:ss" GUICtrlSendMsg($date, $DTM_SETFORMAT_, 0, $style) GUISetState() While 1 $nMsg = GUIGetMsg() If $nMsg = $GUI_EVENT_CLOSE Then Exit if $nMsg = $button then but() WEnd func but() do Sleep (1000) Until _DateDiff("s", _NowCalc(), GUICtrlRead($date)) <= 0 MsgBox(0, "", "matched") EndFunc See Melba's explanation Link to comment Share on other sites More sharing options...
NewPlaza Posted August 27, 2013 Share Posted August 27, 2013 (edited) I would change these two lines of code. $style = "M/d/yyyy hh:mm:ss tt" to $style = "M/d/yyyy h:mm:ss tt" and Until _Now() = GUICtrlRead($date) to Until _Now() > GUICtrlRead($date) #include <GUIConstantsEx.au3> #include <DateTimeConstants.au3> #include <date.au3> GUICreate("My GUI get date", 200, 200, 800, 200) $date = GUICtrlCreateDate("", 10, 10, 185, 20) $button = GUICtrlCreateButton("START", 50, 50, 100, 50) ; to select a specific default format $DTM_SETFORMAT_ = 0x1032 ; $DTM_SETFORMATW $style = "M/d/yyyy h:mm:ss tt" GUICtrlSendMsg($date, $DTM_SETFORMAT_, 0, $style) GUISetState() While 1 $nMsg = GUIGetMsg() If $nMsg = $GUI_EVENT_CLOSE Then Exit if $nMsg = $button then but() WEnd func but() GUICtrlSetState($button, $GUI_DISABLE) do Sleep (1000) Until _Now() > GUICtrlRead($date) MsgBox(0, "", "matched") EndFunc EDIT: Added code Edited August 27, 2013 by NewPlaza Link to comment Share on other sites More sharing options...
Alexxander Posted August 27, 2013 Author Share Posted August 27, 2013 I would change these two lines of code. $style = "M/d/yyyy hh:mm:ss tt" to $style = "M/d/yyyy h:mm:ss tt" and Until _Now() = GUICtrlRead($date) to Until _Now() > GUICtrlRead($date) #include <GUIConstantsEx.au3> #include <DateTimeConstants.au3> #include <date.au3> GUICreate("My GUI get date", 200, 200, 800, 200) $date = GUICtrlCreateDate("", 10, 10, 185, 20) $button = GUICtrlCreateButton("START", 50, 50, 100, 50) ; to select a specific default format $DTM_SETFORMAT_ = 0x1032 ; $DTM_SETFORMATW $style = "M/d/yyyy h:mm:ss tt" GUICtrlSendMsg($date, $DTM_SETFORMAT_, 0, $style) GUISetState() While 1 $nMsg = GUIGetMsg() If $nMsg = $GUI_EVENT_CLOSE Then Exit if $nMsg = $button then but() WEnd func but() GUICtrlSetState($button, $GUI_DISABLE) do Sleep (1000) Until _Now() > GUICtrlRead($date) MsgBox(0, "", "matched") EndFunc EDIT: Added code what is the difference in = and < in this case ? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted August 27, 2013 Moderators Share Posted August 27, 2013 alexander95,When you reply, please use the "Reply to this topic" button at the top of the thread or the "Reply to this topic" editor at the bottom rather than the "Quote" button - we know what we wrote immediately above your post and it just pads the thread unneccessarily. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now