No, not directly.
jorrasdk has already written a script which does something similar - see
Active Document date & time. Here is a suggestion for a macro.
You have to create a user tool with the command line
dir "%f"The tool options must be set to capture the output and replace the existing selection in the current file. Important is that none of the 2 save options is enabled for that tool.
Next you can write the macro. The macro checks if the date is missing in the current text file. If this is the case, it should move to top of the file and insert something very special there which can be later found again. Next it selects the first character of this special string and runs the user tool - the DIR command.
The selected character is replaced now by the output of the DIR command. The macro moves the cursor back to top of the file and first checks, if the DIR command successfully returned the data of this file. If the DIR command could not find the file because you run the macro on a new edit window instead of a file, it does nothting special. But if DIR returned the data of the file the macro searches now for the date string and copies it for example to user clipboard 9.
Then the macro moves back to top of the file and selects everything from here to end of the special string (= captured DIR output + special string) and deletes it. You can now continue with whatever you want to do. Here is an example for that macro.
The macro property
Continue if a Find with Replace not found or
Continue if search string not found must be checked for this macro.
InsertMode
ColumnModeOff
HexOff
UnixReOff
Clipboard 9
ClearClipboard
Top
"#!#!#!#"
Top
StartSelect
Key RIGHT ARROW
EndSelect
RunTool "
case-sensitive name of the user tool with the DIR command"
Top
Find MatchCase RegExp "%File Not Found"
IfNotFound
Find RegExp "%[0-3][0-9].[01][0-9].[12][0-9][0-9][0-9]"
IfFound
Copy
EndIf
EndIf
Top
Find Select "!#!#!#"
Delete
Add
UnixReOn or
PerlReOn (v12+ of UE) at the end of the macro if you do not use UltraEdit style regular expressions by default - see search configuration. Macro command UnixReOff sets the regular expression option to UltraEdit style.
Don't forget to switch back to the Windows clipboard before the macro exits!
The output of the DIR command is on my English Windows XP for German (Austria):
- Code: Select all
Volume in drive F is TEMP
Volume Serial Number is 28E3-127F
Directory of F:\Temp
29.08.2008 13:30 4 Test.txt
1 File(s) 4 bytes
0 Dir(s) 20.543.111.168 bytes free
The 2 regular expression finds in the macro depend on the format of the output of the DIR command.
Well, you could develop a batch file or a Visual Basic Script which returns directly on a call with the current file name the last modification date in the format you need. Then you could call this batch/script as user tool and don't need a macro.