jacob_1998_1999 Posted July 20, 2012 Share Posted July 20, 2012 (edited) I have a little script written out to type out the present time/date on hotkey.My problem is that I would like it to actually type the date of 7 days in advance.I just don't know the technique to apply such a thing. Would anyone be able toguide me to a solution? Please and thank you. Global $PausedHotKeySet("{PAUSE}", "TogglePause")HotKeySet("{ESC}", "Terminate")HotKeySet("{Insert}", "InsertTime")$time=_GetTodaysDate()While 1 Sleep(100)WEndFunc TogglePause() $Paused = Not $Paused While $Paused Sleep(100) ToolTip('Script is "Paused"', 0, 0) WEnd ToolTip("")EndFunc ;==>TogglePauseFunc Terminate() Exit 0EndFunc ;==>TerminateFunc InsertTime() _GetTodaysDate()Send ($Time)EndFunc ;==>ShowMessageFunc _GetTodaysDate($iReturnTime = 1) Local $aMDay[8] = [7, "Sun", "Mon", "Tue", "Wed", "Thur", "Fri", "Sat"], _ $aMonth[13] = [12, "Jan", "Feb", "Mar", "Apr", "May", "June", "July", "Aug", "Sept", "Oct", "Nov", "Dec"], $aTime[2] = ["", ' ' & @HOUR & ':' & @MIN & ':' & '00'] Return $aMDay[@WDAY] & ', ' & @MDAY & ' ' & $aMonth[@MON] & ' ' & @YEAR & $aTime[$iReturnTime]EndFunc ;==>_GetTodaysDate Edited July 21, 2012 by jacob_1998_1999 Link to comment Share on other sites More sharing options...
MrMitchell Posted July 20, 2012 Share Posted July 20, 2012 Check out _DateAdd() in the Help File, should be exactly what you're looking for. Link to comment Share on other sites More sharing options...
jacob_1998_1999 Posted July 20, 2012 Author Share Posted July 20, 2012 Well damn, that is much simpler than the mess that I threw together. Ty. Link to comment Share on other sites More sharing options...
MrMitchell Posted July 20, 2012 Share Posted July 20, 2012 Well damn, that is much simpler than the mess that I threw together. Ty.I agree Link to comment Share on other sites More sharing options...
jacob_1998_1999 Posted July 20, 2012 Author Share Posted July 20, 2012 (edited) I'm apparently skipping something.. I can't output the variable.. O_o Msgbox works, but Send will not.. Tried various things.. /headdesk.. The variable only outputs "2012" skips all Text and will not output the "/" apparently. #include Date.au3 Global $Paused HotKeySet("{PAUSE}", "TogglePause") HotKeySet("{ESC}", "Terminate") HotKeySet("{Insert}", "InsertTime") Local $sNewDate = _DateAdd('n', 10080, _NowCalc()) MsgBox(4096, "", "Don't attack before: " & $sNewDate) $PasteThis = ("Attack After: " + String($sNewDate)) While 1 Sleep(100) WEnd Func TogglePause() $Paused = Not $Paused While $Paused Sleep(100) ToolTip('Script is "Paused"', 0, 0) WEnd ToolTip("") EndFunc ;==>TogglePause Func Terminate() Exit 0 EndFunc ;==>Terminate Func InsertTime() Send("This is lame...") Send ($PasteThis) Send ($sNewDate) EndFunc ;==>ShowMessage Edited July 20, 2012 by jacob_1998_1999 Link to comment Share on other sites More sharing options...
jacob_1998_1999 Posted July 20, 2012 Author Share Posted July 20, 2012 k, apparently, I got it... Syntax errors... #include <Date.au3> Global $Paused HotKeySet("{PAUSE}", "TogglePause") HotKeySet("{ESC}", "Terminate") HotKeySet("{Insert}", "InsertTime") Local $sNewDate = _DateAdd('n', 10080, _NowCalc()) $PasteThis = ("Attack After: ") While 1 Sleep(100) WEnd Func TogglePause() $Paused = Not $Paused While $Paused Sleep(100) ToolTip('Script is "Paused"', 0, 0) WEnd ToolTip("") EndFunc ;==>TogglePause Func Terminate() Exit 0 EndFunc ;==>Terminate Func InsertTime() Send ($PasteThis & $sNewDate) EndFunc ;==>ShowMessage Link to comment Share on other sites More sharing options...
jacob_1998_1999 Posted July 20, 2012 Author Share Posted July 20, 2012 *** You can't use +.. Forgot to use & to combine variables. Link to comment Share on other sites More sharing options...
jacob_1998_1999 Posted July 21, 2012 Author Share Posted July 21, 2012 If anyone else actually decides to use this, Remember simple things like... If you're going to call this, put it in the while loop. You'll never update the time, if you just create the variable when the program is ran.. You need to continuously have it updating the time. Just a little FYI. Link to comment Share on other sites More sharing options...
jacob_1998_1999 Posted July 21, 2012 Author Share Posted July 21, 2012 This is my updated script if anyone decides to build off of it in the future. #include Global $Paused Opt("TrayIconHide", 1) HotKeySet("{PAUSE}", "TogglePause") HotKeySet("{ESC}", "Terminate") HotKeySet("{Insert}", "InsertTime") $PasteThis = ("Attack After: ") While 1 Sleep(100) ToolTip('Running.', 0, 0) Local $sNewDate = _DateAdd('n', 10080, _NowCalc()) WEnd Func TogglePause() $Paused = Not $Paused While $Paused Sleep(100) ToolTip('Script is "Paused"', 0, 0) WEnd ToolTip("") EndFunc ;==>TogglePause Func Terminate() Exit 0 EndFunc ;==>Terminate Func InsertTime() Send ($PasteThis & $sNewDate) EndFunc ;==>ShowMessage 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