Archive: Need help turning a small piece of script into a macro or function, please.


Need help turning a small piece of script into a macro or function, please.
Can anyone take the following code

StrCpy $1 "${__TIMESTAMP__}" -10 -11
IntCmp $1 1 0 less
StrCpy $0 "${__TIMESTAMP__}" -3 -11
;!insertmacro FileCopy '"$EXEDIR\tester.nsi"' '"$EXEDIR\backup-$0"'
goto done
less:
StrCpy $0 "${__TIMESTAMP__}" -3 -10
;!insertmacro FileCopy '"$EXEDIR\tester.nsi"' '"$EXEDIR\backup-$0"'
done:
and turn it into a macro or function which will only return the result/s of string copy?

e.g. !insertmacro "$INSTDIR\$TMEDIR" ;C:\in\backup-71653

The above code is a result at compile time. Can someone help with this AND take it a step further by enhancing the script to also be able to write the RUNTIME TIME?

I'll settle for the compile time example but both will be an incredible find. Thank you for your time ;)

I tried your sample code and from the looks of it like you simply need to convert the date/time string into just the date? If so, I found I found a function created by deguix at :

http://nsis.sourceforge.net/archive/...php?pageid=145


Thanks a million Comperio. I already solved this on another thread. I figured with this question I wanted to learn how to turn basic pieces of script into reusable functions as macros I feel I already understand.

Thank you for your time and resource. It is very well appreciated :)