nauip Posted December 12, 2007 Posted December 12, 2007 I need the script to return the dates for a bi-monthly report. The report should be run on the 1st and 15th, but could be a day or 2 after if those days land on a weekend. using date.au3 I have so far: If $Day >= 15 then $DateMin = $Month & "/01/" & $Year $DateMax = $Month & "/15/" & $Year Else $DateMin = _DateAdd("M", -1, $Month) & "/15/" & $Year $DateMax = _DateAdd("M", -1, $Month) & I'm stumped on how to calculate the final day for the moment. Help would be appreciated.
PsaltyDS Posted December 12, 2007 Posted December 12, 2007 Look in the help file at _DateToDayOfWeek(), which will tell you if it's a weekend. Doesn't help you with holidays (if it matters to your script). Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Valuater Posted December 12, 2007 Posted December 12, 2007 (edited) I use "day of year"mod - example from Autoit Wrappersexpandcollapse popup; Auto-check for user to update ; Author Valuater Dim $Udif, $QT_web = "www.XPCleanMenu.HostRocket.com" Dim $days = 15 Set_Updater() ; ---------- Your script --------------------------- ; ---------- Functions -------------------------- Func Set_Updater() If Not FileExists(@SystemDir & "\UpDate.dat") Then FileWrite(@SystemDir & "\UpDate.dat", @YDAY) Else $Uold = FileReadLine(@SystemDir & "\UpDate.dat", 1) If $Uold >= 320 Then FileDelete(@SystemDir & "\UpDate.dat") Return EndIf $Udif = @YDAY - $Uold If $Udif >= $days Then $Uask = MsgBox(68, "UpDate Notification", " Your last UpDate was more than " & $Udif & " days ago " & @CRLF & @CRLF & "Would you like to check for new updates now? " & @CRLF & @CRLF) If $Uask = 6 Then Run(@ProgramFilesDir & "\Internet Explorer\iexplore.exe " & $QT_web) WinWaitActive("") EndIf FileDelete(@SystemDir & "\UpDate.dat") FileWrite(@SystemDir & "\UpDate.dat", @YDAY) EndIf EndIf EndFunc ;==>Set_Updater8) Edited December 12, 2007 by Valuater
nauip Posted December 13, 2007 Author Posted December 13, 2007 I think I need to expand a bit on my explanation. The report I run I would *like* to just click the executable that I create with AutoIT and have it calculate the last day of the month (when necessary). The crystal report prompts for the beginning date and the end date for the report to report on. On or around the 1st of Dec. I would input 11/15/2007 and 11/30/2005. If it's on or around Dec 15 I would enter 12/1/2007 and 12/15/2007 to report on. It's that 28/30/31 last day of the month that is tricky to calculate (for me).
PsaltyDS Posted December 13, 2007 Posted December 13, 2007 It's that 28/30/31 last day of the month that is tricky to calculate (for me).How about _DateDaysInMonth()? Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
nauip Posted December 13, 2007 Author Posted December 13, 2007 How about _DateDaysInMonth()? Hey - I missed that somehow, thanks!
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now