> I think this would be a major bug producer
What? Let the coder be the judge of that. Any type of macro can lead to bugs if used incorrectly. A mask can certainly be used by the coder if he wants.
BTW, in case someone's thinking: "why not just do a search/replace?", or "why not just use a variable?", the answer is to save typing and to save resources (yes, variables use resources!) when using the same string over and over in your app. In fact, if anyone's against this idea, then they are against the use of standard macros too, since they both are fundamentally the exact same concept.
Here's a practical example of how it saves typing, in conjunction with regular macros too:
Code: Select all
Macro HKCU
#HKEY_CURRENT_USER
EndMacro
StringMacro $SF
Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders
EndStringMacro
appdata$=ReadRegString(HKCU,"$SF","AppData")
history$=ReadRegString(HKCU,"$SF","History")
mymusic$=ReadRegString(HKCU,"$SF","My Music")
mypictures$=ReadRegString(HKCU,"$SF","My Pictures")
myvideo$=ReadRegString(HKCU,"$SF","My Video")
nethood$=ReadRegString(HKCU,"$SF","NetHood")
recent$=ReadRegString(HKCU,"$SF","Recent")
sendto$=ReadRegString(HKCU,"$SF","SendTo")
See how much typing that saves? One could argue that actually leads to
fewer bugs due to removing the risk of typos -- EnableExplicit doesn't catch typos in strings!

And there are no variables created except for the paths that we actually want to store. That's the point too -- no more wasting variables just to specify a string over and over.
For comparison, here's the same code as above, but without any macros at all:
Code: Select all
appdata$=ReadRegString(#HKEY_CURRENT_USER,"Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders","AppData")
history$=ReadRegString(#HKEY_CURRENT_USER,"Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders","History")
mymusic$=ReadRegString(#HKEY_CURRENT_USER,"Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders","My Music")
mypictures$=ReadRegString(#HKEY_CURRENT_USER,"Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders","My Pictures")
myvideo$=ReadRegString(#HKEY_CURRENT_USER,"Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders","My Video")
nethood$=ReadRegString(#HKEY_CURRENT_USER,"Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders","NetHood")
recent$=ReadRegString(#HKEY_CURRENT_USER,"Software\Microsoft\Windows\CurrantVersion\Explorer\Shell Folders","Recent")
sendto$=ReadRegString(#HKEY_CURRENT_USER,"Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders","SendTo")
I know which one I'd rather type.

BTW, with the code block above, did you see how the app would fail to get the recent$ folder? The variable recent$ would be null. String macros would prevent that sort of hard-to-spot bug.
Little John wrote:When I have time, I'll probably do so with my pre-processor LPP.

Just mention in your docs that I came up with the idea, then. Thanks.