Jump to content
Sign in to follow this  
lppforyou

Date function in scheduler on server

Recommended Posts

lppforyou

Hi,

I wrote below trying to run a scheduled report on a server. The application will ask for a date range

"03/03/2013 00:00:00" and "08/03/2013 00:00:00" are the values I put in as the range.

It works perfect when I am logged in, but it will not put down any thing in the data range and generate a report with all data available.

I did use the controlsend / controlclick and the report got generated successfully with the scheduled task, but it failed to input the date range.

Is that because <Date.au3> or any of the codes for date calculation can not work properly without user logged in just like send / click?

Or I am missing something here? (Please be reminded it works perfect when I am logged in on the server.)

Thanks a lot for your help.

----------------------------------------------------

; Include the standard function

#include <Date.au3>

Opt("controlsendKeyDelay", 0)

;Calculate & format current date and the date of 5 days ago

$date = StringSplit(_NowCalcDate(),"/")

$date2 = StringSplit(_DateAdd("d",-5,_NowCalcDate()),"/")

$fdate = $date[3] & "/" & $date[2] & "/" & $date[1]

$fdate2 = $date2[3] & "/" & $date2[2] & "/" & $date2[1]

Run ("D:\report.exe")

winwait("Select data range")

; Input the date range into the report generator

controlsend("Select data range","","[CLASS:tFldSpecEdit; INSTANCE:2]",$fdate2&" 00:00:00")

sleep(500)

controlsend("Select data range","","[CLASS:tFldSpecEdit; INSTANCE:1]",$fdate&" 00:00:00")

sleep(500)

controlclick("Select data range","","[CLASS:TBitBtn; INSTANCE:2]")

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  

×