Current date in the tool command line

Help with setting up and configuring custom user tools in UltraEdit (based on command line input)

Current date in the tool command line

Postby rogowar » Thu Mar 02, 2006 8:27 pm

I've got a command line that runs an executable on the currently editable file and dictates the specific location of the log file output from that executable. I'd like to be able to put something like c:\temp\%n.log_%dt where %dt is the current date and time. Has anyone found such an option, or come up with a fancy hack?

I'm aware of the file based replacement variables, but don't see anything with dates. Thanks.
User avatar
rogowar
Newbie
 
Posts: 4
Joined: Mon Aug 09, 2004 11:00 pm

Re: Current date in the tool command line

Postby Bego » Fri Mar 03, 2006 6:27 am

can't your "executable" (b.t.w.: what is it ? a vb-script ? a selfmade exe ?)
rename the logfile (with date and time) at the end of the process ?
rds Bego
User avatar
Bego
Master
Master
 
Posts: 357
Joined: Wed Nov 24, 2004 12:00 am
Location: Germany

Re: Current date in the tool command line

Postby Mofi » Fri Mar 03, 2006 8:24 am

If you use %sel% for your tool instead of c:\temp\%n.log_%dt and run the tool with this macro, you will get what you want.

The macro copies the full name of the current file, pastes it into a new file, reformats the file name to c:\temp\%n.log_ and adds the current date/time. You can modify the format of the date/time string also with the macro. Then it selects the whole string and runs the tool. After the tool has finished, the new file is discarded.

At the configuration of your tool, do not enable save current file or save all files because of the unsaved new file created by the macro. If you want to save the current file or all files, use the Save or SaveAll macro commands for example after command HexOff.

If you want to see which string the macro produce, remove the last 2 commands.

IfNameIs ""
ExitMacro
EndIf
InsertMode
ColumnModeOff
HexOff
Clipboard 9
CopyFilePath
IfExtIs ""
NewFile
Paste
Else
NewFile
Paste
StartSelect
Find Up Select "."
Delete
EndSelect
EndIf
ClearClipboard
Clipboard 0
Find Up "\"
SelectToTop
Delete
""C:\Temp\"
Key END
".log_"
TimeDate
"""
SelectToTop
RunTool "case-sensitive name of your tool"
CloseFile NoSave
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4055
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna


Return to Custom User Tools/Tool Configuration