Doghouse Posted June 23, 2010 Share Posted June 23, 2010 I know I'm probably missing something simple, but what is the syntax when using macros? Specifically, I'm looking for one that will display yesterday's date expressed in the format mmddyy I know I need something like: @MDAY @MON StringRight(@YEAR,2) If you could please help with the syntax I will be grateful. Link to comment Share on other sites More sharing options...
Doghouse Posted June 23, 2010 Author Share Posted June 23, 2010 I know I'm probably missing something simple, but what is the syntax when using macros? Specifically, I'm looking for one that will display yesterday's date expressed in the format mmddyy I know I need something like: @MDAY @MON StringRight(@YEAR,2) If you could please help with the syntax I will be grateful. Link to comment Share on other sites More sharing options...
Yoriz Posted June 23, 2010 Share Posted June 23, 2010 Macros are used just like you would a variable, join them with an & MsgBox(0, "", @MDAY & @MON & StringRight(@YEAR,2)) GDIPlusDispose - A modified version of GDIPlus that auto disposes of its own objects before shutdown of the Dll using the same function Syntax as the original.EzMySql UDF - Use MySql Databases with autoit with syntax similar to SQLite UDF. Link to comment Share on other sites More sharing options...
Doghouse Posted June 23, 2010 Author Share Posted June 23, 2010 (edited) I think I figured out one way to do it, but is there a cleaner more compact way? For this I simply sent it to a notepad window: ControlSend("[CLASS:Notepad]" , "" , "Edit1" , @MON) ControlSend("[CLASS:Notepad]" , "" , "Edit1" , @MDAY - 1) ControlSend("[CLASS:Notepad]" , "" , "Edit1" , StringRight(@YEAR , 2)) Edited June 23, 2010 by Doghouse Link to comment Share on other sites More sharing options...
jchd Posted June 23, 2010 Share Posted June 23, 2010 Are you really sure that yesterday is always @MDAY - 1? And why bring in Notepad? Adapt this to what you need to do: Local $yesterday = _DateTimeFormat(_DateAdd('D', -1, _NowCalcDate()), 0) ConsoleWrite(StringLeft($yesterday, 6) & StringRight($yesterday, 2) & @LF) This assumes your system has a date-time setting as m/dd/yyyy. This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
Doghouse Posted June 23, 2010 Author Share Posted June 23, 2010 You're right, yesterday isn't always @MDAY - 1. Thanks for pointing that out. As for notepad, it was just a testbed to see how it would display. I'm VERY new to AutoIt and as you can tell, very much a novice when it comes to programming. Please forgive my silly questions. Link to comment Share on other sites More sharing options...
jchd Posted June 23, 2010 Share Posted June 23, 2010 So welcome here but never forget that your best friends have changed and become, in decreasing order of importance, the help file, the forum search feature and lastly Google. This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
l3ill Posted June 23, 2010 Share Posted June 23, 2010 And yet another way... (used as a hotkey named"_datey" which stands for date of yesterday) #include<Date.au3> HotKeySet("^{F4}", "_datey") While 1 Sleep(28800) WEnd Func _datey() $NowDate = _DateAdd('d', -1, _NowCalcDate()) $sNewDate = _DateTimeFormat($NowDate, 2) Send($sNewDate) EndFunc ;==>_datey My Contributions... SnippetBrowser NewSciTE PathFinder Text File Manipulation FTP Connection Tester / INI File - Read, Write, Save & Load Example Link to comment Share on other sites More sharing options...
jchd Posted June 23, 2010 Share Posted June 23, 2010 billo, Without further processing the year will appear as yyyy and not yy as requested. This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
l3ill Posted June 23, 2010 Share Posted June 23, 2010 Hi JC, my experience with this particular piece of code is that it will use the format registered with the OS which can be changed in the regional and language options in the control panel to whatever is desired. cya. My Contributions... SnippetBrowser NewSciTE PathFinder Text File Manipulation FTP Connection Tester / INI File - Read, Write, Save & Load Example Link to comment Share on other sites More sharing options...
jchd Posted June 23, 2010 Share Posted June 23, 2010 Correct, but having to change back and forth a system-wide setting just to remove the century for a date in _one_ application is a terrible way to do it. This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
l3ill Posted June 23, 2010 Share Posted June 23, 2010 Agreed. I like it because it uses whatever format is on the pc I am using at the time and for the people involved it provides a bit of continuity seeing the same format that they are used to seeing. I have to switch back and forth from German to Eng often and this helps immensely. probably should've made that clear... laterz... My Contributions... SnippetBrowser NewSciTE PathFinder Text File Manipulation FTP Connection Tester / INI File - Read, Write, Save & Load Example Link to comment Share on other sites More sharing options...
Doghouse Posted June 23, 2010 Author Share Posted June 23, 2010 THANK YOU!! I can deal with the formatting issue! Your suggestion will solve my issue without using several lines of code! Thank You!!! 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