Bluepoint Design

Practical cost effective solutions   
Macro Express Sample Macro: Date String From File Date

Home
Up
CRLF & TAB Macro
Date String From File Date
Delete to Recycle
Email Settings Check
File Name Increment Macro
eMail Validation
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.

Page last updated: 02/05/2008

Date_String_Rev.mex
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.
 

Demo

Macro Script
Text Box Display: Sample for Date String subroutine
Variable Set String %T5% from File Name
Write Registry String: "feedback"
Macro Run: Create date string from file date
Read Registry String: "feedback"
Text Box Display: Results
Macro Text
<TBOX4:T:1:CenterCenter000278000200:000:Sample for Date String subroutineThis sample macro will demonstrate the date string generator. You will be prompted to choose a file as a sample.><TVAR2:05:09:><REGWSTR:5:HKEY_LOCAL_MACHINE\SOFTWARE\Insight Software Solutions\Macro Express\Miscellaneous\feedback><MACRUN2:Create date string from file date><REGRSTR:5:HKEY_LOCAL_MACHINE\SOFTWARE\Insight Software Solutions\Macro Express\Miscellaneous\feedback><TBOX4:T:1:CenterCenter000278000200:000:ResultsThe date string is %T5%.>
 
Practical cost effective solutions