Sign in to follow this  
Followers 0
Justchris25

Help with dates/months

3 posts in this topic

Hello autoit forums!

I have been using autoit for a few years and love it. The help files great and so are the forums. This is my first post because its the first time I couldnt find my answer using the search :)

func SalesForecast()
for $i = 1 to 4
select
case $i = 1

;--------this is my problem code 
$reportName = "Forcast1"
$dayTop = @MDAY
$monthTop = @MON
$dayBottom = @MDAY+9;--this being the culprit if this is greater then the end of the month then next month + diffrence in days
$monthBottom = @MON 


;----everything below this works fine
case $i = 2 
 $reportName = "Forcast2"
$iDays = _DateDaysInMonth( @YEAR,@MON )
  $dayTop = @MDAY
   $monthTop = @MON
    $dayBottom = $iDays
     $monthBottom = @MON
case $i = 3
 $reportName = "Forcast3"    
$iDays = _DateDaysInMonth( @YEAR,@MON+1)
  $dayTop = 01
   $monthTop = @MON+1
    $dayBottom = $iDays
     $monthBottom = @MON+1
case $i = 4
 $reportName = "Forcast4"
$iDays = _DateDaysInMonth( @YEAR,@MON+2 )
  $dayTop = 01
   $monthTop = @MON+2
    $dayBottom = $iDays
     $monthBottom = @MON +2
EndSelect
sleep(500)
send("!o")
;---All reports tab
   mouseclick("left", 875, 438, 1)
    sleep(500)
 ;---All 
   MouseClickDrag ( "left", 920, 527, 920, 699 );drags down to report
     sleep(500)
      mouseclick("Left", 801, 634, 1);selects sales forecast
       sleep(500)
       
$topDate = 1 
call("TopDate")
call("DateBottom")
sleep(500)
send("!o")
sleep(500)
send("!y")
      $var = PixelGetColor( 885, 417 )
     while $var = "0xD6D3CE" 
    $var = PixelGetColor( 885, 417 )
   sleep(300)
  WEnd
call("email")
call("escape")
;call("print")
call("Initialreports")
next
EndFunc

This pulls up a report, enters the date into the given field then emails it to myself. There are 4 reports I do this with. One of the reports, the first one, has a problem because its not going to the next month. Basically I need to go 10 days from today. Today is the 27th, 10 days from now would be july 7th. How would I do this? Any help would be awesome! Ive been scratching my head at this one for a while.

Thanks in advance

Chris

I marked the part of my code thats wrong up top.

Share this post


Link to post
Share on other sites



Hi,

have a look at _DateAdd

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites

Hi,

have a look at _DateAdd

Mega

Awesome thanks for the info! Thats what I needed woot!

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