Riz Posted June 29, 2006 Share Posted June 29, 2006 I have got one button and input box, when the button pressed input box should get the today date and time, that date should remain when the script stops, until next pressed. Any suggestion and advice is appreciated this is my simple code #include <GuiConstants.au3> #Include <date.au3> GuiCreate("MyGUI", 392, 316,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS)) $Input_1 = GuiCtrlCreateInput("Input1", 70, 100, 140, 30) $Button_2 = GuiCtrlCreateButton("Button2", 230, 100, 70, 30) GuiSetState() While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop case $msg = $Button_2 GUICtrlSetData($Input_1, GUICtrlRead(_NowDate())) Case Else ;;; EndSelect WEnd Exit Link to comment Share on other sites More sharing options...
Xenobiologist Posted June 29, 2006 Share Posted June 29, 2006 (edited) Hi, change the line to GUICtrlSetData($Input_1, _NowDate()) or to this to get the time, too GUICtrlSetData($Input_1, _NowDate()) So long, Mega Edited June 29, 2006 by th.meger 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 More sharing options...
Riz Posted June 29, 2006 Author Share Posted June 29, 2006 Hi,change the line to GUICtrlSetData($Input_1, _NowDate())or to this to get the time, too GUICtrlSetData($Input_1, _NowDate())So long,Mega Thanks for your help. but is that bossible the time remain when the GUI close? Link to comment Share on other sites More sharing options...
randallc Posted June 29, 2006 Share Posted June 29, 2006 (edited) Hi, Save it when you click? ;DateSave.au3 #include <GuiConstants.au3> #Include <date.au3> GuiCreate("MyGUI", 392, 316,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS)) $Input_1 = GuiCtrlCreateInput("Input1", 70, 100, 140, 30) $Button_2 = GuiCtrlCreateButton("Button2", 230, 100, 70, 30) if FileExists(@ScriptDir&"\DateSaver.txt") then GUICtrlSetData($Input_1, FileReadLine(@ScriptDir&"\DateSaver.txt",1)) GuiSetState() While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop case $msg = $Button_2 FileDelete(@ScriptDir&"\DateSaver.txt") FileWrite(@ScriptDir&"\DateSaver.txt",_Now()) GUICtrlSetData($Input_1, _Now()) Case Else ;;; EndSelect WEnd ExitRandallc [EDIT: added "FileDelete(@ScriptDir&"\DateSaver.txt")"] Edited June 30, 2006 by randallc ExcelCOM... AccessCom.. Word2... FileListToArrayNew...SearchMiner... Regexps...SQL...Explorer...Array2D.. _GUIListView...array problem...APITailRW Link to comment Share on other sites More sharing options...
Riz Posted June 30, 2006 Author Share Posted June 30, 2006 Thanks mate. That is great 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