Sign in to follow this  
Followers 0
Pook

Adding onto Time (GUICtrlCreateDate)

5 posts in this topic

okay, I've been playing with this all day, and surfing around. I'm trying to add time. Example: I'm trying to run a schtasks.exe right now, but you can't execute a schtask.exe task with out putting in a time. So I want the script to pull the current time, and add about 45sec, or a minute to the time & then execute.

Runwait ("schtasks.exe /create /tn Test /tr " & $ListPick & " /sc once /st " & $ptime & " /s "& $InputData)

This is the code that is not working..... I can't find a way to add to the $ptime.

$ptime = GUICtrlRead($n) + ????????????

#include <GUIConstants.au3>

GUICreate("time")
If @UNICODE Then
    $DTM_SETFORMAT = 0x1032
Else
    $DTM_SETFORMAT = 0x1005
Endif
$style = "HH:mm:s"
$n=GUICtrlCreateDate ( "", 20, 20, 100, 20, $DTS_TIMEFORMAT)
GuiCtrlSendMsg($n, $DTM_SETFORMAT, 0, $style)
$time = GUICtrlRead($n)
MsgBox(0,"Time",$time)
$ptime = GUICtrlRead($n)
MsgBox(0,"Time 2",$ptime)

ANY IDEAS????

Share this post


Link to post
Share on other sites



Check _DateAdd function. you may have to reformat the value read from control

Share this post


Link to post
Share on other sites

I ended up doing this... (It might be the long way, but it works) it adds 1:15 to the current time.

#include <GUIConstants.au3>

GUICreate("time")
If @UNICODE Then
    $DTM_SETFORMAT = 0x1032
Else
    $DTM_SETFORMAT = 0x1005
Endif
$styleh = "HH"
$style = "mm"
$n=GUICtrlCreateDate ( "", 20, 20, 100, 20, $DTS_TIMEFORMAT)
$h=GUICtrlCreateDate ( "", 20, 20, 100, 20, $DTS_TIMEFORMAT)
GuiCtrlSendMsg($h, $DTM_SETFORMAT, 0, $styleh)
GuiCtrlSendMsg($n, $DTM_SETFORMAT, 0, $style)
$time = GUICtrlRead($n)
$ptime = GUICtrlRead($n)+1
$htime = GUICtrlRead($h)
$ftime= $htime & ":" & $ptime & ":" & "15"
MsgBox(0,"time4", $ftime)

Share this post


Link to post
Share on other sites

Okay... that is much easier!!!!!

Share this post


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
Sign in to follow this  
Followers 0