This macro creates a reverse order date string from a file. The file name is passed from the parent to here where the date values are extracted and assembled into a reverse date order to be passed back to the parent. This is handy for file renames where you would like the files to keep the original file date and be in chronological order when sorted by name. I fond that the files are often moved to other machines causing it to loose the date stamp and also in some of my filing protocols we require the date first in YYYY-MM-DD format. However there are many uses for this.

You will need to write the file name complete with path to the feedback registry value and after the macro completes read it back into whatever variable you like.

The sample file is a complete Macro express file. Simply open it with ME and run the demo macro.

  • Macro Script
  • Variable Save All Variables
    Read Registry String: "feedback"
    Variable Set From File Date/Time
    If Variable %N4% > 9
      Variable Set String %T2% "%N3%-%N4%"
    Else
      Variable Set String %T2% "%N3%-0%N4%"
    End If
    If Variable %N5% > 9
      Variable Set String %T2% "%T2%-%N5%"
    Else
      Variable Set String %T2% "%T2%-0%N5%"
    End If
    Write Registry String: "feedback"
    Variable Restore All Variables
  • Macro Text
  • <VARSR:01><REGRSTR:1:HKEY_LOCAL_MACHINE\SOFTWARE\Insight Software Solutions\Macro Express\Miscellaneous\feedback><VFFILE:0:0:T:4:T:5:T:3:F:1:F:1:F:1:%T1%><IFVAR2:2:04:4:9><TVAR2:02:01:%N3%-%N4%><ELSE><TVAR2:02:01:%N3%-0%N4%><ENDIF><IFVAR2:2:05:4:9><TVAR2:02:01:%T2%-%N5%><ELSE><TVAR2:02:01:%T2%-0%N5%><ENDIF><REGWSTR:2:HKEY_LOCAL_MACHINE\SOFTWARE\Insight Software Solutions\Macro Express\Miscellaneous\feedback><VARSR:05>

Here is a demonstration of how it works.