GraaF1337 Posted September 4, 2014 Posted September 4, 2014 Im trying to make the time show on my GUI, and it shows up just fine, but it wont update. If i start the GUI at 22:23 the clock will start at 22:23 even tho the time might be 22:25 $aclock = 1 if $aclock = 1 Then $clock = GUICtrlCreateLabel ( _NowTime(), 100, 40, 50, 60) GUICtrlSetFont($clock, 15, 800, 4) GUICtrlSetColor($clock, $COLOR_RED) EndIf Am i missing something here?.. o.O
computergroove Posted September 4, 2014 Posted September 4, 2014 What you wrote only shows what the time is when you start the program. Add a While loop. Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html
GraaF1337 Posted September 4, 2014 Author Posted September 4, 2014 I tried this but for some reason it dont work: Func Clock() $aclock = 1 if $aclock = 1 Then $clock = GUICtrlCreateLabel ( _NowTime(), 100, 40, 50, 60) GUICtrlSetFont($clock, 15, 800, 4) GUICtrlSetColor($clock, $COLOR_RED) EndIf EndFunc While 1 AdlibRegister("Clock", 1) Sleep(1) WEnd
Developers Jos Posted September 4, 2014 Developers Posted September 4, 2014 (edited) Create the label one time and then fo a GuiCtrlSetData() to update it in an Adlibregister() func. Only do that AdlibRegister() one time, so not in a loop. Jos Edited September 4, 2014 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
GraaF1337 Posted September 4, 2014 Author Posted September 4, 2014 Create the label one time and then fo a GuiCtrlSetData() to update it in an Adlibregister() func. Only do that AdlibRegister() one time, so not in a loop. Jos Im not sure if i understod you right, but you want me to do it like this? Func Clock() $aclock = 1 if $aclock = 1 Then $clock = GUICtrlCreateLabel ( _NowTime(), 100, 40, 50, 60) GUICtrlSetFont($clock, 15, 800, 4) GUICtrlSetColor($clock, $COLOR_RED) GUICtrlSetData($clock, _NowTime()) EndIf EndFunc While 1 AdlibRegister("Clock", 1) Sleep(1) AdlibRegister("Clock", 1) WEnd o.O
Developers Jos Posted September 4, 2014 Developers Posted September 4, 2014 (edited) I mean something like this ; define your gui here $clock = GUICtrlCreateLabel ( _NowTime(), 100, 40, 50, 60) GUICtrlSetFont($clock, 15, 800, 4) GUICtrlSetColor($clock, $COLOR_RED) AdlibRegister("Clock", 800) While 1 Sleep(20) WEnd Func Clock() GUICtrlSetData($clock, _NowTime()) EndFunc Jos Edited September 4, 2014 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
GraaF1337 Posted September 4, 2014 Author Posted September 4, 2014 I mean something like this ; define your gui here $clock = GUICtrlCreateLabel ( _NowTime(), 100, 40, 50, 60) GUICtrlSetFont($clock, 15, 800, 4) GUICtrlSetColor($clock, $COLOR_RED) AdlibRegister("Clock", 800) While 1 Sleep(20) WEnd Func Clock() GUICtrlSetData($clock, _NowTime()) EndFunc Jos Just tried: Still doesn't work :-/ $aclock = 1 if $aclock = 1 Then $clock = GUICtrlCreateLabel ( _NowTime(), 100, 40, 50, 60) GUICtrlSetFont($clock, 15, 800, 4) GUICtrlSetColor($clock, $COLOR_RED) EndIf While 1 AdlibRegister("Clock", 800) sleep(1) WEnd Func Clock() GUICtrlSetData($clock, _NowTime()) EndFunc
JohnOne Posted September 4, 2014 Posted September 4, 2014 It's standard practice to have a gui before adding controls to a gui. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
GraaF1337 Posted September 4, 2014 Author Posted September 4, 2014 It's standard practice to have a gui before adding controls to a gui. expandcollapse popup#include <Misc.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <NomadMemory.au3> #include <WinApi.au3> #include <SecurityConstants.au3> #include <Security.au3> #include <WinAPIEx.au3> #include <Constants.au3> #include <Console.au3> #include <GDIPlus.au3> #include <Security.au3> #include <WinAPIEx.au3> #include <Date.au3> HotKeySet("{ESC}","_Exit") $Form1 = GUICreate("Clock Test", 614, 536, 597, 271) GUISetState(@SW_SHOW) $aclock = 1 if $aclock = 1 Then $clock = GUICtrlCreateLabel ( _NowTime(), 100, 40, 50, 60) GUICtrlSetFont($clock, 15, 800, 4) GUICtrlSetColor($clock, $COLOR_RED) EndIf While 1 AdlibRegister("Clock", 800) sleep(1) WEnd Func Clock() GUICtrlSetData($clock, _NowTime()) EndFunc Func _Exit() Exit EndFunc Still doesn't work o.O
GraaF1337 Posted September 4, 2014 Author Posted September 4, 2014 Nevermind got it to work! Just completely did as @Jos told me to $clock = GUICtrlCreateLabel ( _NowTime(), 100, 40, 50, 60) GUICtrlSetFont($clock, 15, 800, 4) GUICtrlSetColor($clock, $COLOR_RED) AdlibRegister("Clock", 800) While 1 Sleep(20) WEnd Func Clock() GUICtrlSetData($clock, _NowTime()) EndFunc
JohnOne Posted September 4, 2014 Posted September 4, 2014 Works relatively fine. Widen the label so you can see it. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
JohnOne Posted September 4, 2014 Posted September 4, 2014 Well if you take the adlib out of the loop like it's been advised. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
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