Generate file name that contains current date

Share your macros, knowledge, solutions, services, ...
Post Reply
Petr
Posts: 106
Joined: Tue Oct 18, 2016 1:12 pm

Generate file name that contains current date

Post by Petr » Wed Nov 23, 2016 5:56 pm

This macro sample shows how to generate a file name that contains current data.

Code: Select all

<#> Start of the macro
<cmds>

<#> Define form field for variable vOriginalFileName
<form_item>("f1","Original file name:","EDIT","MyFileName","vOriginalFileName")

<#> Define form field for variable vFileExtension
<form_item>("f1","File extension:","EDIT",".txt","vFileExtension")

<#> Show form
<form_show>("f1","File Name","shell32.dll",0,0,0)

<#> If last key was Esc or button Cancel pressed, exit...
<if_str>("_vCanceled == 1") <exitmacro> <endif>

<#> Else assign to variable vNewFileName value : vOriginalFileName-Year-Month-Day.txt 
<varset>("vNewFileName=%vOriginalFileName%-%_vCurrDate_Year%-%_vCurrDate_MM%-%_vCurrDate_DD%%vFileExtension%","")
<#> Show new file name in message window

<msg>(-100,-100,"vNewFileName","Message",1)

<#> End of the macro

Post Reply