Ace08 Posted December 26, 2012 Posted December 26, 2012 Hi Guys, Lately we've been extracting a bunch from our database so i thought why not make only one that can save queries instead of creating 1:1 apps and adding them on scheduled task, The problem is how do i make a time picker control(attached is a pic)? or rather, can this be done with autoit? If it is possible kindly guide me with the functions to use. Thank you in advance. Work smarter not harder.My First Posted Script: DataBase
somdcomputerguy Posted December 26, 2012 Posted December 26, 2012 Yes, this is possible with AutoIt. Look in the Example Scripts section of this forum for 'countdown' or 'timer' scripts. - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change.
kylomas Posted December 26, 2012 Posted December 26, 2012 (edited) Ace08, The following is in development but will give you something to build on. Start the script and select "Add New Event" from the tray menu. expandcollapse popup#include <Date.au3> #include <WindowsConstants.au3> #include <GuiListView.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <ListboxConstants.au3> #include <String.au3> #include <Array.au3> #include <EditConstants.au3> #include <ComboConstants.au3> #include <DateTimeConstants.au3> #include <GUIConstantsEx.au3> #include <TabConstants.au3> Opt("MustDeclareVars", 1) Opt("traymenumode", 1) if not fileexists(@scriptdir & '\event.ini') then detail() local $additem = TrayCreateItem('Add New Event') local $list = TrayCreateItem('List Events') local $exit = TrayCreateItem('Exit') TrayCreateItem('') local $help = TrayCreateItem('Help') TraySetState() while 1 switch traygetmsg() case $exit Exit case $additem detail() trayitemsetstate($additem,4) case $list list() case $help help() endswitch wend func list() EndFunc func help() endfunc func detail() global $Alarm = GUICreate("Event Add Dialog") global $Asize = WinGetClientSize($Alarm) guisetfont(9,800,default,'Courier New') GUICtrlCreategroup("Date and Time",10,30,$Asize[0]-20,90) guictrlsetfont(-1,12,800) guictrlsetcolor(-1,0xaa0000) guictrlcreatelabel('Start',40,60,50,20) global $sdate = GUICtrlCreateDate(_now(), 90, 60, 100, 20, $WS_TABSTOP) global $stime = GUICtrlCreateDate(@hour & ':' & @min & ':' & @sec, 245, 60, 110, 20, BitOR($DTS_UPDOWN,$DTS_TIMEFORMAT,$WS_TABSTOP)) GUICtrlCreateLabel("End ",40,80,50,20) global $edate = GUICtrlCreateDate(_now(), 90, 80, 100, 20, $WS_TABSTOP) global $etime = GUICtrlCreateDate(@hour & ':' & @min & ':' & @sec, 245, 80, 110, 20, BitOR($DTS_UPDOWN,$DTS_TIMEFORMAT,$WS_TABSTOP)) GUICtrlCreategroup("Duration / Interval", 10, 120, $Asize[0]-20, 100) guictrlsetfont(-1,12,800) guictrlsetcolor(-1,0xaa0000) guictrlcreatelabel('Hours',120,140,50,20) guictrlcreatelabel('Minutes',180,140,50,20) guictrlcreatelabel('Duration',40,160,70,15) guictrlcreatelabel('Interval',40,185,70,15) global $hdur = GUICtrlCreateInput("0", 120, 160, 40, 20) global $udhdur = GUICtrlCreateUpdown($hdur) guictrlsetlimit($udhdur,99,0) global $mdur = GUICtrlCreateInput("0", 180, 160, 40, 20) global $udmdur = GUICtrlCreateUpdown($mdur) guictrlsetlimit($udmdur,99,0) global $hint = GUICtrlCreateInput("0", 120, 185, 40, 20) global $udhint = GUICtrlCreateUpdown($hint) guictrlsetlimit($udhdur,99,0) global $mint = GUICtrlCreateInput("0", 180, 185, 40, 20) global $udmint = GUICtrlCreateUpdown($mint) guictrlsetlimit($udmdur,99,0) GUICtrlCreategroup("Do This...", 10, 220, $Asize[0]-20, 140) guictrlsetfont(-1,12,800) guictrlsetcolor(-1,0xaa0000) global $chkAlarm = GUICtrlCreateCheckbox('Sound Alarm',40,250,100,20) global $chkEmail = GUICtrlCreateCheckbox('Send Email',150,250,100,20) global $chkdisp = GUICtrlCreateCheckbox('Display Message',250,250,130,20) guictrlcreatelabel('Run ',40,270,150,20) global $run = guictrlcreateinput('',40,290,320,20) global $runsrch = guictrlcreatebutton('...',360,290,20,20) guictrlsetfont(-1,9,800,default,'times new roman') global $add = guictrlcreatebutton('Add Event',10,$Asize[1]-30,100,20) global $list = guictrlcreatebutton('List Events',130,$Asize[1]-30,120,20) GUISetState(@SW_SHOW) While 1 switch guigetmsg() case $gui_event_close guidelete($Alarm) return case $runsrch detail_ini_run_filedialog() case $add detail_ini_add() Endswitch WEnd endfunc func detail_ini_run_filedialog() local $runFile = FileOpenDialog('Select file to execute',@scriptdir,'Files (*.*)',9) if @error then ConsoleWrite('filedialog error = ' & @error & @LF) guictrlsetdata($run,$runfile) endfunc func detail_ini_add() local $aSections = IniReadSectionNames(@ScriptDir & '\event.ini') if isarray($asections) then local $new_section = 'Event' & stringformat('%02s',$aSections[0]+1) Else local $new_section = 'Event01' EndIf local $adata[12][2] $adata[0][0] = 'Start Date' $adata[0][1] = guictrlread($sdate) $adata[1][0] = 'Start Time' $adata[1][1] = guictrlread($stime) $adata[2][0] = 'End Date' $adata[2][1] = guictrlread($edate) $adata[3][0] = 'End Time' $adata[3][1] = guictrlread($etime) $adata[4][0] = 'Duration Hours' $adata[4][1] = guictrlread($hdur) $adata[5][0] = 'Duration Minutes' $adata[5][1] = guictrlread($mdur) $adata[6][0] = 'Interval Hours' $adata[6][1] = guictrlread($hint) $adata[7][0] = 'Interval Minutes' $adata[7][1] = guictrlread($mint) $adata[8][0] = 'Alarm Chk' $adata[8][1] = guictrlread($chkAlarm) $adata[9][0] = 'Email Chk' $adata[9][1] = guictrlread($chkEmail) $adata[10][0] = 'Display Chk' $adata[10][1] = guictrlread($chkdisp) $adata[11][0] = 'Run Process' $adata[11][1] = guictrlread($run) ;_arraydisplay($adata) local $ret = IniwriteSection(@scriptdir & '\event.ini',$new_section,$adata,0) if $ret = 0 then ConsoleWrite('ini write error...@error = ' & @error & @LF) endfunc func alarm() endfunc kylomas Edited December 26, 2012 by kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill
Ace08 Posted December 26, 2012 Author Posted December 26, 2012 Thanks somdcomputerguy for the quick response have also do some research and found the needed function #include <GuiDateTimePicker.au3> _GUICtrlDTP_Create($hWnd, $iX, $iY [, $iWidth = 120 [, $iHeight = 21 [, $iStyle = 0x00000000 [, $iExStyle = 0x00000000]]]]) @kylomas wow thanks for the sample script this will come in handy (almost look like the one im making >_<) Work smarter not harder.My First Posted Script: DataBase
kylomas Posted December 26, 2012 Posted December 26, 2012 Ace08, I'll keep that in mind, if I ever get this bitch to fly I'll be glad to compare notes... kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill
Ace08 Posted December 26, 2012 Author Posted December 26, 2012 Although im still in the designing part i'll try a different approach to make it running, hopefuly it'll be finished before January ends Work smarter not harder.My First Posted Script: DataBase
tivp Posted Monday at 08:20 PM Posted Monday at 08:20 PM Eh desarrollado una idea simple que te puede ayudar de referencia. 😉 Seleccionar Fecha y Hora.au3 expandcollapse popup#include <GUIConstantsEx.au3> #include <GuiDateTimePicker.au3> #include <DateTimeConstants.au3> #include <MsgBoxConstants.au3> ; Activar declaración obligatoria de variables para evitar errores de ejecución. Opt("MustDeclareVars", 1) ; Referencias de controles GUI. Global $idDate, $idTime, $hTime, $btnAceptar ; Parámetros de diseño. Global $iTimeWidth = 220 Global $iMargin = 10 Global $iButtonWidth = 100 Global $iWinHeight = 130 ; Dimensiones calculadas de la ventana. Local $iWinWidth = $iTimeWidth + (2 * $iMargin) Local $iButtonCenteredX = ($iWinWidth - $iButtonWidth) / 2 ; Creación de la ventana principal. GUICreate("Seleccionar Fecha y Hora", $iWinWidth, $iWinHeight) ; Control de selección de fecha. $idDate = GUICtrlCreateDate("", $iMargin, 10, $iTimeWidth, 22) _GUICtrlDTP_SetFormat(GUICtrlGetHandle($idDate), "dd'/'MM'/'yyyy") ; Control de selección de hora con ajuste manual. Local $iTimeStyle = BitOR($DTS_TIMEFORMAT, $DTS_UPDOWN) $idTime = GUICtrlCreateDate("", $iMargin, 44, $iTimeWidth, 22, $iTimeStyle) $hTime = GUICtrlGetHandle($idTime) _GUICtrlDTP_SetFormat($hTime, "HH:mm") ; Inicialización del selector con la hora actual. Local $aNow[7] = [False, @YEAR, @MON, @MDAY, @HOUR, @MIN, 0] _GUICtrlDTP_SetSystemTime($hTime, $aNow) ; Botón de confirmación. $btnAceptar = GUICtrlCreateButton("Aceptar", $iButtonCenteredX, 82, $iButtonWidth, 30) ; Mostrar interfaz. GUISetState(@SW_SHOW) ; Gestión de eventos. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $btnAceptar Local $sFecha = GUICtrlRead($idDate) Local $sHora = GUICtrlRead($idTime) MsgBox($MB_ICONINFORMATION, "Resultado", "Fecha: " & $sFecha & @CRLF & "Hora: " & $sHora) EndSwitch WEnd
water Posted Monday at 08:32 PM Posted Monday at 08:32 PM Welcome to AutoIt and the forum! You noticed that the last post is nearly 13 years old and the OP has been absent since then? My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
argumentum Posted Monday at 08:32 PM Posted Monday at 08:32 PM Since @Ace08 is unlikely to thank you for the code and welcome you to the forum, I'll do it. There are some forum rules, like all forums do. One is that all communications are in English. Welcome to the forum Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting.
tivp Posted Monday at 08:35 PM Posted Monday at 08:35 PM 1 minute ago, argumentum said: Desde @Ace08 Es poco probable que te agradezca el código y te dé la bienvenida al foro, lo haré. hay algunos reglas del foro , como hacen todos los foros. Una es que todas las comunicaciones son en inglés. Bienvenido al foro Thank you for welcoming me, it is well received. argumentum 1
argumentum Posted Monday at 08:35 PM Posted Monday at 08:35 PM We need some of those markers like phones have. Those dot,dot,dot ( ... ) so we get to know that someone is typing Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting.
tivp Posted Monday at 08:36 PM Posted Monday at 08:36 PM 3 minutes ago, water said: Welcome to AutoIt and the forum! You noticed that the last post is nearly 13 years old and the OP has been absent since then? I did realize that the publication had been going on for a long time but I felt that I should leave the help for future ones.
argumentum Posted Monday at 08:40 PM Posted Monday at 08:40 PM 1 minute ago, tivp said: but I felt that I should leave the help for future ones. No problem. I like doing that too, but here is seen as necro-posting Your first post, and not even a question, but some code. You're good in my book ( just don't do it again ) tivp and SOLVE-SMART 1 1 Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting.
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