在日期字段中设置日期

时间:2017-11-10 07:17:25

标签: windows user-interface testing autoit

我正在尝试在Windows环境中的日期选择器字段中设置日期(显示在附加图像中)。它不是an AutoIt date control(我没有创建这个字段)。我使用了以下代码:

; enter from date

$sFromDate  = "09/01/2017"
ControlFocus($hWnd, "", "WindowsForms10.SysDateTimePick32.app.01")
ControlSetText($hWnd, "", "WindowsForms10.SysDateTimePick32.app.01", $sFromDate )

AutoIt窗口信息工具显示有关控件的信息,但不显示其中的项目(月/日/年)。我正在寻找任何设置日期的工具,不一定是AutoIt。

enter image description here

1 个答案:

答案 0 :(得分:0)

参见_GUICtrlDTP_SetSystemTime的描述和示例 https://www.autoitscript.com/autoit3/docs/libfunctions/_GUICtrlDTP_SetSystemTime.htm

尝试使用此示例:

#include <GuiDateTimePicker.au3>

Local $a_Date[7] = [False, @YEAR, 8, 19, 21, 57, 34]

$hDTP = ControlGetHandle("Set_Window_Title_Here", "", "WindowsForms10.SysDateTimePick32.app.01")
_GUICtrlDTP_SetSystemTime($hDTP, $a_Date)