Jump to content

Recommended Posts

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 = Win_10   Build = 19044   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.

Link to post
Share on other sites

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 = Win_10   Build = 19044   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.

Link to post
Share on other sites

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 = Win_10   Build = 19044   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.

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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By bogQ
      Simple script latest autoit version.
      #include <GUIConstantsEx.au3> #include <FontConstants.au3> Example() Func Example() GUICreate("test", 800, 540) GUISetFont(12, $FW_NORMAL, $GUI_FONTNORMAL) GUICtrlCreateLabel("testing",680,310) GUISetState(@SW_SHOW) Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>Example After using GUISetFont(12) or GUISetFont(12, $FW_NORMAL, $GUI_FONTNORMAL) every GUI control is changed to italic.
       
      Am i doing something wrong?

    • By cramaboule
      Hello,
      I am %*&%*+$ with the Windows Updates every 2 weeks or so... And my people who never do their updates...
      So... fortunately, I have AutoIt and my brain (lol)
      Basically my approach is the following: I push the new WU and users will receive a notification when they want to do their updates
      1. Reboot, install and shutdown at the end of the day
      2. schedule a reboot
      3. reboot now
      As I am in Switzerland I made it in 3 languages: French, German, English (thank to Brett Francis (BrettF))
      The thing behind: I download the msu file from the Windows Catalog. I put it on my server where they can download it (internally and externally). I made a dat file (ini file) with the new build of Win 10/11 and the KB file name. I put as well the file time of the exe. Thus it can do an automatique update of my AutoIt prg itself.
      My prg will download the dat file compare and do the updates if necessary, then display the gui.
      There is a task scheduler that runs my prg.
      You 'just' need to run once on the PC and it will deploy by itself. (I push it through a sort of Remote Management software, that run under 'SYSTEM')
      What you need to change for you:
      - In Write-datFile.au3: 
      Line 17: Your own server (for me it is an UNC path)
      $sServerFile = '\\Path\to\myWEB\SERVER\ManageWU.dat' - In Shutdown.au3:
      Line 36: Your own Task Scheduler folder:
      Local $iPID = RunWait(@ComSpec & " /c " & 'SCHTASKS /Delete /TN "FOLDER\shutdown" /F', @SystemDir, @SW_HIDE) - Your Logo !!! (logo.bmp)
      - In ManageWU.au3:
      Line 12: Your own server (for me it is an UNC path)
      #AutoIt3Wrapper_Run_After=copy "%out%" "\\Path\to\myWEB\SERVER\" Line 66: Your external web adresse:
      Global $sRootDwl = 'https://path/to/myWEB/SERVER' Line 182, 230, 354, 417, 435: Your own Task Scheduler folder:
      Local $iPID = RunWait(@ComSpec & ' /c SCHTASKS /Delete /TN "MYFOLDER\Reboot" /F', @SystemDir, @SW_HIDE) Local $iPID = RunWait(@ComSpec & ' /c SCHTASKS /create /TN "MYFOLDER\ManageWU" /xml "' & $rootdir & '\ScheduleManageWU.xml" /F', @SystemDir, @SW_HIDE, BitOR($STDERR_CHILD, $STDOUT_CHILD)) Local $iPID = RunWait(@ComSpec & ' /c SCHTASKS /create /TN "MYFOLDER\Reboot" /RU "SYSTEM" /xml "' & $rootdir & '\ScheduleTemp.xml" /F', @SystemDir, @SW_HIDE) Run('SCHTASKS /create /tn "MYFOLDER\Shutdown" /tr "' & $rootdir & '\Shutdown.exe" /sc ONSTART /RU "SYSTEM" /RL "HIGHEST" /F') Run('SCHTASKS /create /tn "MYFOLDER\Shutdown" /tr "' & $rootdir & '\Shutdown.exe" /sc ONSTART /RU "SYSTEM" /RL "HIGHEST" /F') FileInstall are in 220-226: just compile other programs and make sure they are in the right place...
      FileInstall('logo.bmp', $rootdir & '\', $FC_OVERWRITE + $FC_CREATEPATH) FileInstall('.\LngFiles\FRENCH.XML', $rootdir & '\LngFiles\', $FC_OVERWRITE + $FC_CREATEPATH) FileInstall('.\LngFiles\ENGLISH.XML', $rootdir & '\LngFiles\', $FC_OVERWRITE + $FC_CREATEPATH) FileInstall('.\LngFiles\GERMAN.XML', $rootdir & '\LngFiles\', $FC_OVERWRITE + $FC_CREATEPATH) FileInstall('ScheduleManageWU.xml', $rootdir & '\', $FC_OVERWRITE + $FC_CREATEPATH) FileInstall('ScheduleReboot.xml', $rootdir & '\', $FC_OVERWRITE + $FC_CREATEPATH) FileInstall('Shutdown.exe', $rootdir & '\', $FC_OVERWRITE + $FC_CREATEPATH) I believe that's all !

      Comments are welcome
      C.
      Edit: typo

      ManageWU-IE.zip
    • By woffi
      Hi,
      I'm afraid I'm just stupid or blind or both: how can I read user input from an AutoIt console program? Just a simple String input, terminated with pressing "Return"? 

      This can't be difficult, but I can't find a solution.
    • By WhaleJesus
      #include <FileConstants.au3> #include <MsgBoxConstants.au3> #include <file.au3> ; Create Data Folder if it doesn't exist yet If FileExists(@ScriptDir & "\Data") Then Else ShellExecute(@ScriptDir) DirCreate(@ScriptDir & "\Data") EndIf ; Playlist Name & location input Global $playlistnameinput = InputBox("Playlist", "Enter The playlist name", _ "Name") Global $playlistlocationinput = InputBox("Location", "Specify where you would like the playlist folder to be stored", @ScriptDir & "\Playlists\" & $playlistnameinput) ; Create file in Data folder and other vars Global $sDataFile = @ScriptDir & "\Data\Data.txt" Global $DataHandle = FileOpen($sDataFile, 1) Global $DataFileLine = FileReadLine($sDataFile, 1) FileClose($DataFileLine) MsgBox(0, "", $DataFileLine, 10) ; Prove it exists If FileExists($sDataFile) Then _FileWriteToLine($DataHandle, $DataFileLine, $playlistnameinput, True, True) $DataFileLine += 1 _FileWriteToLine($DataHandle, 1, $DataFileLine, True) Else MsgBox($MB_SYSTEMMODAL, "Error", "File " & $sDataFile & "Does not exist") EndIf Global $sPDataFile = @ScriptDir & "\Data\" & $playlistnameinput & "_Data.txt" Global $PDataHandle = FileOpen($sPDataFile, 1) If FileExists($sPDataFile) Then _FileWriteToLine($PDataHandle, 1, $playlistnameinput, True, True) _FileWriteToLine($PDataHandle, 2, $playlistlocationinput, True, True) Else MsgBox($MB_SYSTEMMODAL, "Error", "File " & $sPDataFile & "Does not exist") EndIf _FileWriteToLine stopped working and i don't know what it is in my code that's causing this, please help
    • By DannyJ
      $sCommands1 = 'powershell.exe Get-ChildItem' $iPid = run($sCommands1   , @WorkingDir , @SW_SHOW , 0x2) $sOutput = ""  While 1     $sOutput &= StdoutRead($iPID)         If @error Then             ExitLoop         EndIf  WEnd ;~ msgbox(0, '' , $sOutput) ConsoleWrite("$sOutput") ConsoleWrite($sOutput) ConsoleWrite(@CRLF) $aOutput = stringsplit($sOutput ,@LF , 2) For $i=0 To  UBound($aOutput) - 1 Step 1     ConsoleWrite($aOutput[$i]) Next The script above reads the whole directory into a one dimensional array, but I need to work with the array, so I need to split the array into multiple dimensions.
      I have already read some forum answers here, and I have already tried these commands:
       
      Are there any way to use the $aOutput variable like in PowerShell:
      PowerShell:
      $a = Get-ChildItem $a.Mode I imagine this in AutoIt  $aOutput
      ConsoleWrite($aOutput[i].Mode) Or if I split this command into 2 dimension like:
      For $i To UBound($aOutput)-1 Step 1 ConsoleWrite($aOutput[$i][1]) ConsoleWrite($aOutput[$i][2]) Next  
×
×
  • Create New...