(Solved) How to set specific time in DateTime control

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
shjoshi123
Posts: 4
Joined: 18 Nov 2014, 06:18

(Solved) How to set specific time in DateTime control

Post by shjoshi123 » 21 Nov 2014, 07:58

How do I set specific time in GUI control ?
I have two Time controls and the first Time (vT1) should be 09:15:00.
Following is not working. I am not able to find anything in google. :headwall: I am a noob here.

Code: Select all

GUI, Show, w300 h440 x800 y90, Nest Vwap Backfill
/*
;Create Menu and Menu items
	Menu, Menubar, Add, &Settings ;, gOnSettings
	Menu, Menubar, Add , &Help  ;, gHelpmenu
	Gui, Menu, Menubar
*/
; Create GUI Body
FormatTime, TimeString,,09:15:00

GUI,Font, 8 ,

Gui, Add ,Text, x10 y10 W90 h15, Backfill Gap from -
Gui, Add, DateTime, xp+95 y8 w70 h20 vT1 choose%TimeString%,time
Gui, Add, Text,xp+75 y10 w40 h15,   Up To
Gui, Add, DateTime, xp+40 y8 w70 h20 vT2, time

GUI, Add, GroupBox, x10 yp+20 w250 h25, Backfill from -
GUI, Add, Radio, xp+85 yp+5 w70 h15 vNestPlus g_OnPlusbackfill, NEST Plus
GUI, Add, Radio, xp+85 yp w90 h15 Checked1 vNpn g_OnPlusbackfill, VWAP/Stat

Gui, Add, Text,x10 yp+25 w50 h15, `Date-from
Gui, Add, DateTime, xp+55 yp-2 w90 h20 vD1  Disabled
Gui, Add, Text, xp+95 yp+2 w30 h15, To
Gui, Add, DateTime, xp+30 yp-2 w90 h20 vD2 Disabled

Gui, Add, Button, x10 yp+352 w80 h25 vButton1gSelectAll, Select All  
Gui, Add, Button, xp+90 yp w80 h25 vButton2gDeSelectAll, DeSelect All
Gui, Add, Button, xp+90 yp w80 h25 vButton3gOn_DoBackfill_Click, Do Backfill

return
ExitApp
Last edited by shjoshi123 on 24 Nov 2014, 07:17, edited 1 time in total.

User avatar
AlphaBravo
Posts: 586
Joined: 29 Sep 2013, 22:59

Re: How to set specific time in DateTime control

Post by AlphaBravo » 21 Nov 2014, 10:12

removed gLabels so I can test it

Code: Select all

GUI, Show, w300 h440 x800 y90, Nest Vwap Backfill
FormatTime, TimeString, 20140101091500, hh:mm:ss
GUI,Font, 8 ,
Gui, Add ,Text, x10 y10 W90 h15, Backfill Gap from -
Gui, Add, DateTime, xp+95 y8 w70 h20 vT1 , % TimeString
Gui, Add, Text,xp+75 y10 w40 h15,   Up To
Gui, Add, DateTime, xp+40 y8 w70 h20 vT2, time

GUI, Add, GroupBox, x10 yp+20 w250 h25, Backfill from -
GUI, Add, Radio, xp+85 yp+5 w70 h15 vNestPlus , NEST Plus
GUI, Add, Radio, xp+85 yp w90 h15 Checked1 vNpn , VWAP/Stat

Gui, Add, Text,x10 yp+25 w50 h15, `Date-from
Gui, Add, DateTime, xp+55 yp-2 w90 h20 vD1  Disabled
Gui, Add, Text, xp+95 yp+2 w30 h15, To
Gui, Add, DateTime, xp+30 yp-2 w90 h20 vD2 Disabled

Gui, Add, Button, x10 yp+352 w80 h25 vButton1gSelectAll, Select All  
Gui, Add, Button, xp+90 yp w80 h25 vButton2gDeSelectAll, DeSelect All
Gui, Add, Button, xp+90 yp w80 h25 vButton3gOn_DoBackfill_Click, Do Backfill
return

shjoshi123
Posts: 4
Joined: 18 Nov 2014, 06:18

Re: How to set specific time in DateTime control

Post by shjoshi123 » 21 Nov 2014, 11:24

AlphaBravo wrote:removed gLabels so I can test it
Thanks for swift reply. I tried that. It gives non editable DateTime control.

Bkid
Posts: 31
Joined: 13 Jun 2014, 12:19

Re: How to set specific time in DateTime control

Post by Bkid » 21 Nov 2014, 11:28

GuiControl (info from the help file):


GuiControl, Sub-command, ControlID [, Param3]

DateTime/MonthCal: Specify for Param3 a date-time stamp in YYYYMMDDHH24MISS format. Specify %A_Now% to use the current date and time (today). For DateTime controls, Param3 may be omitted to cause the control to have no date/time selected (if it was created with that ability). For MonthCal controls, a range may be specified if the control is multi-select.

just me
Posts: 9574
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: How to set specific time in DateTime control

Post by just me » 21 Nov 2014, 11:28

Maybe:

Code: Select all

NineFifteen := A_YYYY . A_MM . A_DD . "0915"
Gui, Add ,Text, x10 y10 W90 h15, Backfill Gap from -
Gui, Add, DateTime, xp+95 y8 w70 h20 1 Choose%Ninefifteen% vT1, HH:mm:ss
Gui, Add, Text,xp+75 y10 w40 h15, Up To
Gui, Add, DateTime, xp+40 y8 w70 h20 1 vT2, HH:mm:ss
Gui, Show, , DateTime
Return
GuiClose:
ExitApp
Related: DateTime

shjoshi123
Posts: 4
Joined: 18 Nov 2014, 06:18

Re: How to set specific time in DateTime control

Post by shjoshi123 » 22 Nov 2014, 04:50

Thanks "just me". That is working well. With 9:15:00 as default in time selector.

However, I haven't understood significance of that number "1" before "choose%Ninefifteen%"

If I remove that 1, the control turns into date selector.


just me
Posts: 9574
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: How to set specific time in DateTime control

Post by just me » 23 Nov 2014, 05:04

DateTime Options wrote:1: Specify the number 1 in Options to provide an up-down control to the right of the control to modify date-time values, which replaces the button of the drop-down month calendar that would otherwise be available. This does not work in conjunction with the format option LongDate described above.
Source

shjoshi123
Posts: 4
Joined: 18 Nov 2014, 06:18

Re: How to set specific time in DateTime control

Post by shjoshi123 » 24 Nov 2014, 03:07

Ahh... Yes. Thanks a lot.

Post Reply

Return to “Ask for Help (v1)”