Search the Community
Showing results for tags 'weekday'.
-
I'm new to Auotit but I have built a simple script that "runs" a different "batch" file based on certain days of the workweek. The script works now, but I was wanting to eliminate the need for a manual date entry. For example "First Batch' needs to run every Tuesday thru Thursday however "Second Batch" needs to run only on Friday and "Third Batch" needs to run only on Monday. In addition the 1st batch file runs on Tuesday, say 06/06 (the "FW" section) but then needs to actually report (the F4 date) the next weekday so this Batch actually needs 2 dates verified. What I'm trying to do is when the script is initiated it gets the date, verifies if and which weekday it is and in turn goes to and runs the appropriate "Batch' file. I've found ways to verify weekdays but can't find anything to do all of the above. Any help is MUCH appreciated. ;P10 ShellExecute("C:\Program Files (x86)\Ericom Software\PowerTerm Enterprise\Sessions\mir00p10.PTS") WinWait('(A) Soutwest P10 : PowerTerm Pro Enterprise Suite') WinActivate('(A) Soutwest P10 : PowerTerm Pro Enterprise Suite') Send('$Login) Sleep(3000) Send('{Enter}') Sleep(3000) Send($Password) Send('{Enter}') Sleep(3000) ; ****First Batch file run Send('Batch') Sleep(3000) Send('{Enter}') Send('FW') Send('{Enter}') Send('{DOWN}') Send($Date) Send('{Enter}') Send('{Enter}') Send($Date) Send('{F9}') Send('Y') Sleep(3000) Send('{Enter}') Send('{F4}') Send('Y') Sleep(3000) Send('{Enter}') Send($Date) Send('{Enter}') Send('0620') Send('{Enter}') SEND('{!}SW0410PM.FWR') Send('{Enter}') Sleep(3000) Send('Y') Send('{Enter}') Sleep(3000) Send('{F9}') Sleep(3000) ; ****Second Batch file run Send('Batch') Sleep(3000) Send('{Enter}') Send('FW') Send('{Enter}') Send('{DOWN}') Send($Date) Send('{Enter}') Send('{Enter}') Send($Date) Send('{F9}') Send('Y') Sleep(3000) Send('{Enter}') Send('{F4}') Send('Y') Sleep(3000) Send('{Enter}') Send($Date) Send('{Enter}') Send('0620') Send('{Enter}') SEND('{!}SO0411AM.FWR') Send('{Enter}') Sleep(3000) Send('Y') Send('{Enter}') Sleep(3000) Send('{F9}') Sleep(3000) ; ****Third Batch file run Send('Batch') Sleep(3000) Send('{Enter}') Send('FW') Send('{Enter}') Send('{DOWN}') Send($Date) Send('{Enter}') Send('{Enter}') Send($Date) Send('{F9}') Send('Y') Sleep(3000) Send('{Enter}') Send('{F4}') Send('Y') Sleep(3000) Send('{Enter}') Send($Date) Send('{Enter}') Send('0620') Send('{Enter}') SEND('{!}SW0411AM.LOA') Send('{Enter}') Sleep(3000) Send('Y') Send('{Enter}') Sleep(3000) Send('{F9}') Sleep(3000) Send('EXIT')
-
;This script will calculate the Nth weekday of any month. Just replace the numbers for $Year, $Month, $Week, and $Weekday with numbers of your choice, ;Some lines are not really needed but are there to allow testing and proofing. It is based on Excel formula. #include <Date.au3> Global $tmp, $Year = "2019", $Month = "2", $Week = 2, $WeekDay = 4 Global $aNth = StringSplit("First ,Second ,Third ,Fourth ,Fifth ", ",") Func GetWeekDay($Week, $Year, $Month, $WeekDay) Local $LastDay = 8 - $WeekDay, $EndDay = $Week * 7 + 1 $Month = $Month > 10 ? $Month : "0" & $Month Local $iWday = _DateToDayOfWeek($YEAR, $Month, $LastDay) Return $YEAR & "/" & $Month & "/" & $EndDay - $iWday EndFunc MsgBox(0,'',$aNth[$Week] & _DateDayOfWeek($WeekDay) & " of " & _DateToMonth($Month) & _ " " & $Year & " is " & GetWeekDay($Week, $Year, $Month, $WeekDay) ) GetNthWeekDay.au3
-
I am attempting to run an Autoit.exe with schtasks every weekday @ 9:05 am. I have the below C:\>SchTasks /Create /TN "P10Run" /TR "O:\AUTOIT\P40 Run.au3" /SC WEEKLY /D MON, TUE,WED,THU,FRI /ST 09:05:00 SUCCESS: The scheduled task "P10Run" has successfully been created. I also did a "test" run : C:\>Schtasks /Run /TN "P10Run SUCCESS: Attempted to run the scheduled task "P10Run". But when I run my query to verify success my "Last Result" seems to indicate that the script did not run: C:\>SCHTASKS /QUERY /FO LIST /V /TN "P10RUN" Folder: \ HostName: xxxxxxxxxxxxxxxx TaskName: \P10RUN Next Run Time: N/A Status: Could not start Logon Mode: Interactive only Last Run Time: 6/14/2017 9:08:56 AM Last Result: -2147024894 Author: xxxxxxx Task To Run: O:\AUTOIT\P40 Run.au3 Start In: N/A Comment: N/A Scheduled Task State: Enabled Idle Time: Disabled Power Management: Stop On Battery Mode, No Start On Batterie s Run As User: xxxxxxxxx\xxxxxxxx Delete Task If Not Rescheduled: Enabled Stop Task If Runs X Hours and X Mins: 72:00:00 Schedule: Scheduling data is not available in this f ormat. Schedule Type: Weekly Start Time: 9:05:00 AM Start Date: 6/14/2017 End Date: N/A Days: MON, TUE, WED, THU, FRI Months: Every 1 week(s) Repeat: Every: Disabled Repeat: Until: Time: Disabled Repeat: Until: Duration: Disabled Repeat: Stop If Still Running: Disabled C:\> Is there something missing in my command? Also is there a better way to make sure that the script does in fact sun successfully? Thanks In Advance!