cedrIck Posted March 5, 2007 Posted March 5, 2007 Hello.. I am trying the date function to create something for my script. Today is 5 Mar 2007. #include <Date.au3> Run("notepad.exe") WinWaitActive("Untitled - Notepad") $sNewDate = _DateAdd( 'd',1, _NowCalcDate()) Send($sNewDate) What comes out in the notepad is 2007/03/06. But is there anyway i can make notepad that writes 6-Mar-2007??...please help me..i've tried to search for all fuctions in the command list le..thanks.. =)
Moderators SmOke_N Posted March 5, 2007 Moderators Posted March 5, 2007 $sString = '2007/03/06' $aSplit = StringSplit($sString, '/') $sOutput = $aSplit[3] & '-' & _GetMonth($aSplit[2]) & '-' & $aSplit[1] MsgBox(0, '', $sOutput) Func _GetMonth($nMonth) Local $aMonth = StringSplit('January,February,March,April,May,June,July,' & _ 'August,September,October,November,December', ',') Return $aMonth[$nMonth] EndFunc Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
cedrIck Posted March 5, 2007 Author Posted March 5, 2007 $sString = '2007/03/06' $aSplit = StringSplit($sString, '/') $sOutput = $aSplit[3] & '-' & _GetMonth($aSplit[2]) & '-' & $aSplit[1] MsgBox(0, '', $sOutput) Func _GetMonth($nMonth) Local $aMonth = StringSplit('January,February,March,April,May,June,July,' & _ 'August,September,October,November,December', ',') Return $aMonth[$nMonth] EndFunc Hi SmOke_N..Thanks for ur help!!.. The program u gave me was fantastic..but i need a program that goes with the computer's date. And i also need to like for example..if today the date is 5 Mar, i need the date that comes out in the MsgBox to be one day later than today..means 6 Mar. Could u help me more on this??.. sorry abt tat..need ur help on this..thanks.. =)
Moderators SmOke_N Posted March 5, 2007 Moderators Posted March 5, 2007 (edited) Hi SmOke_N..Thanks for ur help!!.. The program u gave me was fantastic..but i need a program that goes with the computer's date. And i also need to like for example..if today the date is 5 Mar, i need the date that comes out in the MsgBox to be one day later than today..means 6 Mar. Could u help me more on this??.. sorry abt tat..need ur help on this..thanks.. =)So add 1 to it.Edit:I believe there is Add functions in the help file for dates aren't there? Edited March 5, 2007 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
cedrIck Posted March 5, 2007 Author Posted March 5, 2007 So add 1 to it. Edit: I believe there is Add functions in the help file for dates aren't there? $sString = _DateAdd( 'd',1, _NowCalcDate()) $aSplit = StringSplit($sString, '/') $sOutput = $aSplit[3] & '-' & _GetMonth($aSplit[2]) & '-' & $aSplit[1] MsgBox(0, '', $sOutput) Func _GetMonth($nMonth) Local $aMonth = StringSplit('Jan,Feb,Mar,Apr,May,Jun,Jul,' & _ 'Aug,Sep,Oct,Nov,Dec', ',') Return $aMonth[$nMonth] EndFunc Is it something like tat??..i can't seem to work it out this way..sorrie..
Moderators SmOke_N Posted March 5, 2007 Moderators Posted March 5, 2007 (edited) Works fine for me when I add #include <date.au3>#include <date.au3> $sString = _DateAdd( 'd',1, _NowCalcDate()) $aSplit = StringSplit($sString, '/') $sOutput = $aSplit[3] & '-' & _GetMonth($aSplit[2]) & '-' & $aSplit[1] MsgBox(0, '', $sOutput) Func _GetMonth($nMonth) Local $aMonth = StringSplit('January,February,March,April,May,June,July,' & _ 'August,September,October,November,December', ',') Return $aMonth[$nMonth] EndFunc Edited March 5, 2007 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
cedrIck Posted March 5, 2007 Author Posted March 5, 2007 Works fine for me when I add #include <date.au3>#include <date.au3> $sString = _DateAdd( 'd',1, _NowCalcDate()) $aSplit = StringSplit($sString, '/') $sOutput = $aSplit[3] & '-' & _GetMonth($aSplit[2]) & '-' & $aSplit[1] MsgBox(0, '', $sOutput) Func _GetMonth($nMonth) Local $aMonth = StringSplit('January,February,March,April,May,June,July,' & _ 'August,September,October,November,December', ',') Return $aMonth[$nMonth] EndFunc Oh..haha..sorrie..you are a pro in AutoIT man!!..haha..thanks..this has been realli a great help to me!!..cya =) cheers..
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