Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PLEASE HELP!!! Variable Issue
#1
str TM
TM.time("%m%d%Y%H%M")
ren "c:\d.txt" "c:\temp\variable d.txt"

I need to append the TM variable to the d.txt file name

Example:

d.txt now becomes mmddyyyyhhmmd.txt

Any suggestions?

Help file sucks for this.
#2
Code:
;/
function'str $filename [~folder] [$dateformat]

;Formats full path from 3 parts:
;folder, current date and filename.
;filename can be either full path or file name.
;If folder is not specified, extracts from
;filename or uses temp folder.
;dateformat can be specified, as with str.time.

;EXAMPLE
;str f="c:\d.txt"
;ren f FormatTempFileName(f "$temp$")


if(folder.len) folder.expandpath; if(!folder.end("\")) folder+"\"
else folder.getpath(filename); if(!folder.len) folder.expandpath("$temp$\")

if(!len(dateformat)) dateformat="%m%d%Y%H%M "
str TM.time(dateformat)

str s.from(folder TM _s.getfilename(filename 1))
ret s

In QM, create new function FormatTempFileName. Paste this code using menu Edit->Other formats->Paste escaped. Call this function from a macro (one example is given in code).


Forum Jump:


Users browsing this thread: 1 Guest(s)