Jump to content

Macro Syntax


Recommended Posts

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

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

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 by Doghouse
Link to comment
Share on other sites

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 here
RegExp tutorial: enough to get started
PCRE 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

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

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 here
RegExp tutorial: enough to get started
PCRE 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

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
Link to comment
Share on other sites

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 here
RegExp tutorial: enough to get started
PCRE 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

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.

Link to comment
Share on other sites

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 here
RegExp tutorial: enough to get started
PCRE 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

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...:mellow:

laterz...

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...