scintilla4evr Posted September 28, 2013 Share Posted September 28, 2013 I want to introduce you simple atomic clock. It retreives data from http://www.atomic-clock.org.uk/atomic-clock.php. Code: expandcollapse popup#cs Atomic Clock 1.0 By scintilla4evr #ce #include <GUIConstants.au3> #include <IE.au3> Global $sURL = "http://www.atomic-clock.org.uk/atomic-clock.php" $hGUI = GUICreate("Atomic Clock", 300, 100) $cidTime = GUICtrlCreateLabel("", 0, 0, 300, 100) GUICtrlSetFont(-1, 58) GUISetState() $oIE = _IECreate($sURL, 0, 0) AdlibRegister("QuickClose", 1) AdlibRegister("Timer", 1) While 1 Switch GUIGetMsg() Case -3 ExitLoop EndSwitch WEnd AdlibUnRegister("QuickClose") AdlibUnRegister("Timer") _IEQuit($oIE) Func QuickClose() If GUIGetMsg() = -3 Then AdlibUnRegister("QuickClose") AdlibUnRegister("Timer") _IEQuit($oIE) Exit EndIf EndFunc Func Timer() $oTimeObj = _IEGetObjById($oIE, "anzeige_zeit") $sTime = _IEPropertyGet($oTimeObj, "innertext") GUICtrlSetData($cidTime, $sTime) $oTimeObj = 0 EndFunc Details: Performance: POOR Size: 870 B If someone asks, why you need this, say: BECAUSE NO ONE HAS. Just Monika. Spoiler CompileIt - an experimental AutoIt-to-machine code compiler Apps: Power Calculator | AutoItFX | AudioBox | vPaint 4 | Color Book Editor UDFs: Advanced Math UDF | Blender UDF | Motion Graphics UDF | ColorEx UDF | ChakraCore UDF | CUDA UDF Adobe UDFs: Photoshop | ... Examples & Small Scripts: Distorting GDI+ Paths with other Paths | Combining GDI+ Paths with different combine modes | _WinAPI_DwmEnableBlurBehindWindow in Windows 10 | Running AutoIt code from any web browser Link to comment Share on other sites More sharing options...
lorenkinzel Posted September 28, 2013 Share Posted September 28, 2013 scintilla4evr; changes below are (opinion) improvements to performance. expandcollapse popup#cs Atomic Clock 1.0 By scintilla4evr #ce #include <GUIConstantSex.au3> #include <GUIConstants.au3> #include <IE.au3> #include <WindowsConstants.au3> Global $sURL = "http://www.atomic-clock.org.uk/atomic-clock.php" $hGUI = GUICreate("Atomic Clock", 300, 100, Default, Default, $GUI_SS_DEFAULT_GUI, $WS_EX_COMPOSITED);COMPOSITED is what I was after $cidTime = GUICtrlCreateLabel("", 0, 0, 300, 100) GUICtrlSetFont(-1, 58) GUISetState() $oIE = _IECreate($sURL, 0, 0) ;AdlibRegister("QuickClose", 1) AdlibRegister("Timer", 100);** DllCall("psapi.dll", "bool", "EmptyWorkingSet", "handle", -1) While 1 Switch GUIGetMsg() Case -3 ExitLoop EndSwitch WEnd ;AdlibUnRegister("QuickClose") AdlibUnRegister("Timer") _IEQuit($oIE) ;Func QuickClose() ;If GUIGetMsg() = -3 Then ;AdlibUnRegister("QuickClose") ;AdlibUnRegister("Timer") ; _IEQuit($oIE) ; Exit ;EndIf ;EndFunc Func Timer() $oTimeObj = _IEGetObjById($oIE, "anzeige_zeit") $sTime = _IEPropertyGet($oTimeObj, "innertext") GUICtrlSetData($cidTime, $sTime) $oTimeObj = 0 EndFunc Link to comment Share on other sites More sharing options...
Rogue5099 Posted September 30, 2013 Share Posted September 30, 2013 (edited) scintilla4evr, Looking at the web page the tab for browser updates time as well. So why not update the Window Title with the time as well. Also cleaned up the code a little. Didn't show the GUI until after webpage is created that way the GUI isn't empty while waiting on information. Also since it is a simple code removed includes and just replaced with value. #cs Atomic Clock 1.0 By scintilla4evr #ce #include <IE.au3> Opt("WinTitleMatchMode", 2) GUICreate("Atomic Clock", 300, 100, -1, -1, -1, 0x02000000) $cidTime = GUICtrlCreateLabel("", 0, 0, 300, 100) GUICtrlSetFont(-1, 58) $oIE = _IECreate("http://www.atomic-clock.org.uk/atomic-clock.php", 0, 0) AdlibRegister("Timer", 100) GUISetState() While 1 If GUIGetMsg() = -3 Then ExitLoop WEnd AdlibUnRegister("Timer") _IEQuit($oIE) Func Timer() $oTimeObj = _IEGetObjById($oIE, "anzeige_zeit") $sTime = _IEPropertyGet($oTimeObj, "innertext") GUICtrlSetData($cidTime, $sTime) WinSetTitle("Atomic Clock", "", $sTime & " : Atomic Clock") EndFunc Edited September 30, 2013 by Rogue5099 My projects: Inventory / Mp3 Inventory, Computer Stats Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted September 30, 2013 Moderators Share Posted September 30, 2013 Rogue5099, Also since it is a simple code removed includes and just replaced with valueVery bad coding practice and not to be encouraged. Use the variable names as then you will not be looking at the code in a few months (or even days if you reach a certain age) and thinking: "WTF does that mean?". 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...
Rogue5099 Posted September 30, 2013 Share Posted September 30, 2013 Very bad coding practice and not to be encouraged. Use the variable names as then you will not be looking at the code in a few months (or even days if you reach a certain age) and thinking: "WTF does that mean?". Undertandable, so here : #include <IE.au3> Global Const $WS_EX_COMPOSITED = 0x02000000 Global Const $GUI_EVENT_CLOSE = -3 Opt("WinTitleMatchMode", 2) GUICreate("Atomic Clock", 300, 100, -1, -1, -1, $WS_EX_COMPOSITED) $cidTime = GUICtrlCreateLabel("", 0, 0, 300, 100) GUICtrlSetFont(-1, 58) $oIE = _IECreate("http://www.atomic-clock.org.uk/atomic-clock.php", 0, 0) AdlibRegister("Timer", 100) GUISetState() While 1 If GUIGetMsg() = $GUI_EVENT_CLOSE Then ExitLoop WEnd AdlibUnRegister("Timer") _IEQuit($oIE) Func Timer() $oTimeObj = _IEGetObjById($oIE, "anzeige_zeit") $sTime = _IEPropertyGet($oTimeObj, "innertext") GUICtrlSetData($cidTime, $sTime) WinSetTitle("Atomic Clock", "", $sTime & " : Atomic Clock") EndFunc My projects: Inventory / Mp3 Inventory, Computer Stats 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