Input Date

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
nkwhftw
Newbie
Posts: 8
Joined: Thu Sep 01, 2005 12:44 pm

Input Date

Post by nkwhftw » Thu Sep 01, 2005 5:04 pm

I have built a script in which there is one location that requires a date field to be populated. My problem is that I would like to have the date placed automatically and updated each time it ran. I have to run the report for today, tomorrow and the next day. I have to place the date in manually. Is there a way that I can have the date field auto populated?

Here is a partial script that the date is in:

Press Tab * 9
Wait>1.01
Send>090105 'This is the date field I have manually placed
Wait>1.95
Press Tab * 2
...........
........

I found that the field "Date" can be used with a + or - sign. I just don't know how to place the Date so that it will place it correctly at the location. Also I don't know if the Date will be in the format MMDDYY.

Any help will be appreciated.

CEW


.
.
.

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Thu Sep 01, 2005 5:57 pm

To add a day to a date do:

GetDate>date
Add>date,1

This will return tomorrow's date in the system shortdate format. So the format depends on how your system is set up. If you know what this is you could then parse that string to return the format you require. But should the shortdate format change or should this be run on a different computer it will differ.

Therefore a neater approach is to use VBScript as follows:

//Put this VBStart block at start of script
VBSTART
Function DDMMYY
tomorrow = DateAdd("d",1,Date)
DD = Right("0" & Day(tomorrow),2)
MM = Right("0" & Month(tomorrow),2)
YY = Right(Year(tomorrow),2)
DDMMYY = DD & MM & YY
End Function
VBEND

//Then to get tomorrow's date formatted and send it do this:
VBEval>DDMMYY,tomorrow
Send>tomorrow

Adjust the format to suit your needs.
MJT Net Support
[email protected]

nkwhftw
Newbie
Posts: 8
Joined: Thu Sep 01, 2005 12:44 pm

Date problem

Post by nkwhftw » Thu Sep 01, 2005 6:51 pm

Thanks, it worked perfectly. I wish I had asked sooner. I would have saved my self many hours. I used the VB script.

Again Thanks

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts