Jump to content
Simpel

[Solved] Update GUICtrlCreateDate but Time

Recommended Posts

Simpel

Hi, I created a gui with date field but formatted as time in HH:mm. It always shows "now-time". Even if I try to set it with GUICtrlSetData.

#include <DateTimeConstants.au3>
#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>

Example()

Func Example()
    GUICreate("My GUI get date", 200, 200, 800, 200)
    Local $idDate = GUICtrlCreateDate("", 20, 20, 100, 20, $DTS_TIMEFORMAT)

    ; to select a specific default format
    Local $sStyle = "HH:mm" ; Just display hours and minutes <<<<<<<<<<<<<<<<<<<<<<<<<<<<
    GUICtrlSendMsg($idDate, $DTM_SETFORMATW, 0, $sStyle)

    ConsoleWrite(GUICtrlRead($idDate) & @CRLF)
    GUICtrlSetData($idDate, "00:00")
    ConsoleWrite(GUICtrlRead($idDate) & @CRLF)

    GUISetState(@SW_SHOW)

    ; Loop until the user exits.
    While GUIGetMsg() <> $GUI_EVENT_CLOSE
    WEnd

    MsgBox($MB_SYSTEMMODAL, "Time", GUICtrlRead($idDate))
EndFunc   ;==>Example

How can I set the time field with another time and how can this field be set blank?

Regards, Conrad

Edited by Simpel
[Solved]

SciTE4AutoIt = 3.7.3.0   AutoIt = 3.3.14.2   AutoItX64 = 0   OS = Win7Pro SP1   OSArch = X64   Language = 0407/german
H:\...\AutoIt3\SciTE     H:\...\AutoIt3      H:\...\AutoIt3\Include     (H:\ = Network Drive)

   88x31.png  Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind.

Share this post


Link to post
Share on other sites
Simpel

OK, I can do it this way.

Nevertheless I want to understand why GUICtrlSetData is not working.

Thanks, Conrad


SciTE4AutoIt = 3.7.3.0   AutoIt = 3.3.14.2   AutoItX64 = 0   OS = Win7Pro SP1   OSArch = X64   Language = 0407/german
H:\...\AutoIt3\SciTE     H:\...\AutoIt3      H:\...\AutoIt3\Include     (H:\ = Network Drive)

   88x31.png  Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind.

Share this post


Link to post
Share on other sites
Subz

You need to submit the full date and time for example:

GUICtrlSetData($idDate, "2017/03/23 00:00:00")

 

Share this post


Link to post
Share on other sites
Simpel

Thank you, that works and explains why my "00:00" not work.

Regards, Conrad


SciTE4AutoIt = 3.7.3.0   AutoIt = 3.3.14.2   AutoItX64 = 0   OS = Win7Pro SP1   OSArch = X64   Language = 0407/german
H:\...\AutoIt3\SciTE     H:\...\AutoIt3      H:\...\AutoIt3\Include     (H:\ = Network Drive)

   88x31.png  Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind.

Share this post


Link to post
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

  • Similar Content

    • Fin
      By Fin
      Hello...:)
      I have done extensive searches on this issue before posting but have not found a solve. Any help will be greatly appreciated.
      ;I have a valid AutoIt support question and kindly provided the details of my system: ;AutoIt Version: V3.3.14.2 [X32] ;Windows Version: WIN_VISTA [X86] ;Language: English (0409) #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Global $form = GUICreate("O_o", 146, 66, -1, -1) Global $inputNorth = GUICtrlCreateInput("", 12, 24, 53, 21) Global $btnSet = GUICtrlCreateButton("Set Controls", 72, 16, 65, 33, $BS_DEFPUSHBUTTON) GUISetState(@SW_SHOW) HotKeySet("{UP}","_north") While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $btnSet Global $goNorth= "-" & GUICtrlRead($inputNorth) MsgBox(0,"", "go north: " & $goNorth) Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd ;functions Func _north() $pos=MouseGetPos() MouseMove($pos[0], $pos[1]$goNorth,0) ;-results in syntax error EndFunc As you can see, $goNorth gets its value from $inputNorth
      (the MsgBox shows it works)
      But I cannot get MouseMove() to take $goNorth
      If I use: MouseMove($pos[0], $pos[1]$goNorth,0) --I get a syntax error.
      If I use: MouseMove($pos[0], $pos[1] & $goNorth,0) --I no longer get a syntax error, but that's not right so the function, (likely), moves by zero.
      So is there a way I can get MouseMove() to take a variable for that parameter?
      Thank you in advance should you choose to help!
    • Shedunn
      By Shedunn
      I've been looking through some different functions(not sure if that's the right word) to get the Date and time and I can't find one that doesn't include "/ " or ":" in what is returned.

      I'm trying to create a file name with this format "QuickConfig_MMDDYYYY_HHMM"  (doesn't matter if 24 or 12hr format)
      #include <Date.au3> Func _SaveConfig MouseClick('primary',155, 46, 1, 0) ;clicks save as WinWait('Save bluePRINT Configuration As...','', 4) MouseClick('primary',632, 47, 1, 0) ;clicks the file path bar $Documents = @MyDocumentsDir $FilePath = $Documents & '\BP3 Configs' Send($FilePath) Send('{ENTER}') MouseClick('primary',166, 580, 1, 0) ;clicks file name bar $FileName = 'QuickConfig_' & _NowDate & '_' & _NowTime Send($FileName) Send('{ENTER}') EndFunc  
       
      I'm wondering if there is a function somewhere to do this?
    • CodingMonkey81
      By CodingMonkey81
      All,
      I'm working on automating the update process for a piece of software that we use at my company. The installer file always contains the version number as a part of the file name (eg InstallFile_9342.msi) and the numbers always change with every update.
      How do I use AutoIt to run the program? I know I can't use a wildcard in place of the numbers when using the "Run" command. 
      I tried 
      Local $aArray = _FileListToArray("C:\path\to\file", "InstallFile_*.msi", 0, 1) Run("$aArray") and I also tried
      Local $bInstall = FileFindFirstFile("InstallFile_*.msi") Run("$bInstall") and neither worked. 
      Can someone please point me in the right direction? I've done some searching on the forum and haven't found anyone in a similar situation before.
      Thanks!
    • RHolmes
      By RHolmes
      I have a program that has a control that changes color a few seconds into running. So ideally, I would poll this to tell when an event has occurred. 
      I can't seem to retrieve the correct color value for a control. It always seems to return white indicating that its selecting somewhere else in the window.
      In the PixelGetColor call I'm adding half the width to the x value and subtracting half the height to the y value  in order to get the center of the control. (assuming the coords returned by ControlGetPos are top left - which i can't be sure of) But I've also tried without modifying the x/y and with changing the PixelCoordMode option to 2. Maybe I'm making a silly mistake and can't see it? Any help would be appreciated.
      Code is below:
      Opt("PixelCoordMode", 0)
      FileChangeDir( "C:\Where\My\File\Is" );
      Run( "MyProgram.exe" )
      Local $hClient = WinWaitActive( $CLIENT_TITLE, "", 10 )
      Local $systemIndicatorClassNN= "[CLASS:Qt5QWindowIcon; INSTANCE:99]"
      Local $hSystemIndicator = ControlGetHandle ( $hClient, "", $systemIndicatorClassNN)
      Local $xywh = ControlGetPos ( $hClient, "", $hSystemIndicator )
      For $i = 10 To 1 Step -1
            $color = PixelGetColor ( $xywh[0] + ($xywh[2]/2), $xywh[1] - ($xywh[3]/2), $hClient )
            LogToFile( $color )
            Sleep( 2000 )
      Next
    • nacerbaaziz
      By nacerbaaziz
      hello
      please i need to link a progress bar with a time can you help me?
      e.g
      i want to set a progress bar for 10 sec
      am waiting for your answers
      thank you.
×