我有一个代码可以打开名为Enmark的软件,并浏览菜单。到达特定屏幕后,需要插入日期范围。我希望在代码运行之前ahk生成一个弹出窗口,要求用户选择DDMMYY格式的2个日期(开始日期和结束日期),然后在到达适当的屏幕时调用它。 如果弹出窗口是日历,那就更好了。
; Run E2A Extracts
settitlematchmode 2
run "C:\Program Files (x86)\Enmark Systems\enlink7\Enlink.exe" "C:\Program Files (x86)\Enmark Systems\enlink7\Enmark Systems - Enlink.CFT"
winwait Enlink
SLEEP 1000
ifwinnotexist Enlink
sleep 1000
send nwuser1{ENTER}
sleep 5000
;
;QMPRDRP2 (Quality Metals Production Report 2) file extract
winactivate Enlink
send{ESC}QMPRDRP2{ENTER}7{ENTER}E{ENTER}REP{ENTER}{ENTER}
;send (Starting Date DDMMYY){ENTER}
;send (Ending Date DDMMYY){ENTER}
WINWAIT DPREP
WINACTIVATE DPREP
SLEEP 2000
winmaximize DPREP
答案 0 :(得分:0)
Gui, -MinimizeBox -MaximizeBox +hwndGuiID
Gui, Add, Text,, Start date:
Gui, Add, MonthCal, vStartCal
Gui, Add, Text,, End date:
Gui, Add, MonthCal, vEndCal
Gui, Add, Button, gAcceptBtn, Accept dates and continue
Gui, Show,, Get Dates
Loop
{
WinWaitClose, ahk_id %GuiID%
MsgBox, 4132, Check dates, % "Start Date: " StartDate "`nEnd Date: " EndDate "`n`nIs this correct?"
IfMsgBox, Yes
break
Gui, Show
}
return
;
; *** End of auto-execute section ***
AcceptBtn:
Gui, Submit
StartDate := SubStr(StartCal, 5, 2) . SubStr(StartCal, 7, 2) . SubStr(StartCal, 3, 2)
EndDate := SubStr(EndCal, 5, 2) . SubStr(EndCal, 7, 2) . SubStr(EndCal, 3, 2)
Esc::ExitApp