Jump to content

Function not giving a reply


Recommended Posts

I am making this to keep a countdown clock accurate to when something happens on a server. It happens every 8 hours and the only way I can think is to use the _Date_Time_GetTimeZoneInformation function to get the current timezone and then compare it to the timezone the server uses to start the event.

Well when I click the button nothing changes, it updates the label and displays nothing. Am I missing something?

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Timers.au3>
#include <Misc.au3>
#include <GuiToolbar.au3>
#include <Date.au3>



$aOld = _Date_Time_GetTimeZoneInformation ()

$Form1 = GUICreate("Form1", 597, 144, 192, 124)
    $Label1 = GUICtrlCreateLabel("Label1", 248, 64, 36, 17)
    $Button1 = GUICtrlCreateButton("Show current timezone", 8, 8, 89, 25)
    GUISetState(@SW_SHOW)

While 1
    $guistat = GUIGetMsg()
        Select
            Case $guistat = $GUI_EVENT_CLOSE
                ExitLoop
            Case $guistat = $Button1
            GUICtrlSetData($Label1, $aOld)
        EndSelect
WEnd

Maybe I could skip comparing the time on the computer and just get the current time for the timezone I need, then get the countdown?

Edited by Tomoya
Link to comment
Share on other sites

I'm not exactly sure why you think the time zone information will help in this case, but the function _Date_Time_GetTimeZoneInformation() returns an array. You can't access it the way you're trying to to change the label.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

I'm not exactly sure why you think the time zone information will help in this case, but the function _Date_Time_GetTimeZoneInformation() returns an array. You can't access it the way you're trying to to change the label.

Dang it! I read that too!!! with 0 equaling the daylight savings.

Maybe you can give me a different idea because the only way I can think of keeping the countdown timer accurate every time its opened is by using the timezone.

The server runs it every 8 hours and it happens at +1 GMT. I was going to take that timezone and then compare it to the times when it happens and generate the time remaining. Can you think of any other ways to go about it?

Edited by Tomoya
Link to comment
Share on other sites

Why can't you just use the time on the computer it's being run on? You can use the time zone information to correct for UTC, but that won't tell you what time it is, that requires you to get that from somewhere else. Look at the functions @Hour, @Minute, and @Second for the current time information.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

That would work perfectly if I was using it just for my self, but I intend to give this out to other users that are located around the world and have different timezones then me. So using that method would end up in users in any other timezone then mine getting it wrong.

If I am understanding you correctly.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...