fraudh8er Posted November 9, 2004 Share Posted November 9, 2004 does anyone know how use this to check a date (YYYYMD) and give back what day of the week it is. more importantly i just want to know if it is a monday or not. Or shoudl I be doing this another way? thanks :) Link to comment Share on other sites More sharing options...
Josbe Posted November 9, 2004 Share Posted November 9, 2004 Like this? #include <Date.au3> $szDay= _DateDayOfWeek( @WDAY, 0 ) If ($szDay = "Monday") Then MsgBox(0, "", "Today is Monday!" ) Else MsgBox(0, "", "Now isn't Monday, is: " & $szDay ) EndIf AUTOIT > AutoIt docs / Beta folder - AutoIt latest beta Link to comment Share on other sites More sharing options...
RocTx Posted November 9, 2004 Share Posted November 9, 2004 Another method: Dim $Dow[7], $Today, $i $Dow[0] = "1Sunday" $Dow[1] = "2Monday" $Dow[2] = "3Tuesday" $Dow[3] = "4Wednesday" $Dow[4] = "5Thursday" $Dow[5] = "6Friday" $Dow[6] = "7Saturday" $Today = StringLeft(@Wday,1) For $i = 0 to 7 If $Today = String($i) Then MsgBox(0, "Day of the Week","Today's Day of the Week is: " & StringTrimLeft($Dow[$i-1],1)) EndIf Next RocTx Link to comment Share on other sites More sharing options...
RocTx Posted November 9, 2004 Share Posted November 9, 2004 Josbe, I like yours better.. I was unaware of the _DateDayOfWeek() function. #include <Date.au3> $szDay= _DateDayOfWeek( @WDAY, 0 ) MsgBox(0, "", "Today is " & $szDay) Smaller code. Great! RocTx Link to comment Share on other sites More sharing options...
fraudh8er Posted November 9, 2004 Author Share Posted November 9, 2004 yah i used the @WDAY to do it. worked pretty well, couple lines of code.but i have an other dillemma, i am using the monday for updating with this script, so evertime they select the exe it will check for updates if the creation dates are not the same and if it is monday. working with mde they get corrupt, alot. anyways, my problem is if they open the mde more than once on the monday it will run the update again, which is a problem. is there anyway to store that the update has been run already today and if the creation dates are the same then just open the program.i guess i could store the computer name in a text file and look for it. if the name is there dont update, open program. if computer name not there, run update, put name there, and open program.any other thoughts.Josbe, I like yours better.. I was unaware of the _DateDayOfWeek() function.#include <Date.au3>$szDay= _DateDayOfWeek( @WDAY, 0 )MsgBox(0, "", "Today is " & $szDay)Smaller code. Great!RocTx<{POST_SNAPBACK}> Link to comment Share on other sites More sharing options...
scriptkitty Posted November 9, 2004 Share Posted November 9, 2004 you could make an INI and store the last day it was run on each person's computer. Or better yet a registry entry You can also automate it with task squeduler, etc etc. AutoIt3, the MACGYVER Pocket Knife for computers. Link to comment Share on other sites More sharing options...
fraudh8er Posted November 9, 2004 Author Share Posted November 9, 2004 i can do tha task scheduler, not sure if that is a good idea. how would the registry key thign work. the ini file doesnt seem plausible but i will mess with it and see what happens. thanksyou could make an INI and store the last day it was run on each person's computer. Or better yet a registry entry You can also automate it with task squeduler, etc etc.<{POST_SNAPBACK}> Link to comment Share on other sites More sharing options...
SlimShady Posted November 9, 2004 Share Posted November 9, 2004 Felt like helping you a bit. You can simply change the functions INIRead and INIWrite to RegRead and RegWrite if you want. Here's the script: ;On startup CheckUpdate() ;Rest of the script... Func CheckUpdate() Dim $LastRun Dim $Today $Monday = "2" $Today = @YEAR & @MON & @MDAY $LastRun = INIRead(@ScriptDir, "Update", "LastRun", $Today) If $LastRun = $Today OR @WDAY <> $Monday Then Return Else ;Update part here... INIWrite(@ScriptDir, "Update", "LastRun", $Today) EndIf EndFunc Link to comment Share on other sites More sharing options...
JSThePatriot Posted November 9, 2004 Share Posted November 9, 2004 (edited) Okay what I would do is something like the following. I have this schedule my scripts...to run once on one day...modify as needed. Dim $day = 1;Scans on Sunday (Sunday = 1 thru Saturday = 7) Dim $scanned = 0;Makes sure the program only runs once on Sunday's Dim $delay = 1;Time in hours that it checks the date $delay = $delay * 60 * 60 * 1000 While 1 If @WDAY = $day Then If $scanned = 0 Then ;Your Code goes Here $scanned = 1 EndIf Else $scanned = 0 EndIf Sleep($delay) WEnd Edit: With the above you can run this once and be assured that it will do what it is supposed to every monday before anyone is there unless they are there between 12AM and 1AM. I hope that helps, JS Edited November 9, 2004 by JSThePatriot AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more) Link to comment Share on other sites More sharing options...
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