This is my Showmacros.au3 script. It is one of the first scripts I have made with AutoIt , but I have enhanced it a few times. It uses an array with all the macro names in the same order as the helpfile and reports all macro's with their values (if available) with arraydisplay. If you don't like this order, just rearrange the array and be happy!
#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w- 7
#include <Array.au3>
AutoItSetOption("MustDeclareVars", 1)
Local $asMacroNames = [ _
"@AppDataCommonDir", "@AppDataDir", "@AutoItExe", "@AutoItPID", "@AutoItVersion", "@AutoItX64", "@COM_EventObj", "@CommonFilesDir", _
"@Compiled", "@ComputerName", "@ComSpec", "@CPUArch", "@CR", "@CRLF", "@DesktopCommonDir", "@DesktopDepth", "@DesktopDir", "@DesktopHeight", _
"@DesktopRefresh", "@DesktopWidth", "@DocumentsCommonDir", "@error", "@exitCode", "@exitMethod", "@extended", _
"@FavoritesCommonDir", "@FavoritesDir", "@GUI_CtrlHandle", "@GUI_CtrlId", "@GUI_DragFile", "@GUI_DragId", "@GUI_DropId", "@GUI_WinHandle", _
"@HomeDrive", "@HomePath", "@HomeShare", "@HotKeyPressed", "@HOUR", "@IPAddress1", "@IPAddress2", "@IPAddress3", "@IPAddress4", "@KBLayout", "@LF", _
"@LocalAppDataDir", "@LogonDNSDomain", "@LogonDomain", "@LogonServer", "@MDAY", "@MIN", "@MON", "@MSEC", "@MUILang", "@MyDocumentsDir", _
"@NumParams", "@OSArch", "@OSBuild", "@OSLang", "@OSServicePack", "@OSType", "@OSVersion", "@ProgramFilesDir", "@ProgramsCommonDir", "@ProgramsDir", _
"@ScriptDir", "@ScriptFullPath", "@ScriptLineNumber", "@ScriptName", "@SEC", "@StartMenuCommonDir", "@StartMenuDir", "@StartupCommonDir", "@StartupDir", _
"@SW_DISABLE", "@SW_ENABLE", "@SW_HIDE", "@SW_LOCK", "@SW_MAXIMIZE", "@SW_MINIMIZE", "@SW_RESTORE", "@SW_SHOW", "@SW_SHOWDEFAULT", "@SW_SHOWMAXIMIZED", _
"@SW_SHOWMINIMIZED", "@SW_SHOWMINNOACTIVE", "@SW_SHOWNA", "@SW_SHOWNOACTIVATE", "@SW_SHOWNORMAL", "@SW_UNLOCK", "@SystemDir", "@TAB", "@TempDir", "@TRAY_ID", _
"@TrayIconFlashing", "@TrayIconVisible", "@UserName", "@UserProfileDir", "@WDAY", "@WindowsDir", "@WorkingDir", "@YDAY", "@YEAR", "@NoMacro"]
; above are the macro's from autoit v3.3.16.1 These can also be found in file au3check.dat but than a compiled script (exe) would need to know where to find this file.
Local $sMacroValue
Local $aMacroArray[UBound($asMacroNames)][4]
For $k = 0 To UBound($asMacroNames) - 1
$aMacroArray[$k][0] = $asMacroNames[$k]
$aMacroArray[$k][1] = ""
$aMacroArray[$k][2] = Execute($asMacroNames[$k])
If @error Then
$aMacroArray[$k][1] = "N/A"
$aMacroArray[$k][3] = ""
$sMacroValue = " "
Switch $asMacroNames[$k]
Case "@COM_EventObj"
$sMacroValue &= "Only valid in a COM even function"
Case "@GUI_CtrlId", "@GUI_CtrlHandle", "@GUI_WinHandle"
$sMacroValue &= "Only valid in an event function"
Case "@GUI_DragFile", "@GUI_DragId", "@GUI_DropId"
$sMacroValue &= "Only valid in a drop event function"
Case "@exitCode", "@exitMethod"
$sMacroValue &= "Only valid in a function in OnAutoItExitRegister"
Case "@TRAY_ID"
$sMacroValue &= "Only valid in Tray event function"
Case Else
$sMacroValue &= "Not a valid macro"
EndSwitch
$aMacroArray[$k][2] = $sMacroValue
Else ; hex/dec view for non-visual macro's
$aMacroArray[$k][3] = VarGetType($aMacroArray[$k][2])
Switch $asMacroNames[$k]
Case "@CR", "@CRLF", "@LF", "@TAB"
$aMacroArray[$k][2] = "Hex: " & StringToBinary($aMacroArray[$k][2]) & " Dec: " & _ArrayToString(StringToASCIIArray($aMacroArray[$k][2]), " ")
Case "@HOUR", "@MDAY", "@MIN", "@MON", "@MSEC", "@SEC", "@WDAY", "@YDAY", "@YEAR"
$aMacroArray[$k][2] = " now: " & $aMacroArray[$k][2] ; group these in view sort on macrovalue
EndSwitch
EndIf
Next
_ArrayDisplay($aMacroArray, "AutoIt Macro's Overview. Type = VarGetType(Execute('@Macro'))", Default, $ARRAYDISPLAY_COLALIGNLEFT + $ARRAYDISPLAY_NOROW, Default, "Macro Name|Avail.|Macro Value|Type")
ShowMacros.au3