|
|
Hello,
I modified your macro because I found there is problem with _OR_ and _AND_ (which we will fix in next release). The modified macro changes file name based on the user's input this way: If user specifies the new file name will be "Gerda" then the
file with name "102347Trudy.txt" will be changed to "102347Gerda.txt". Just run the macro below when you have the file selected in Windows Explorer (I have tested it on Windows 7).
<#> Enter Name
<cmds><varset>("name=","Namen Eingeben")
<#> Start edit filename
<keys><F2><cmds><wx>(250)
<#> Copy the file name to clipboard
<clp_copyselected>(0,5)
<#> Set helper variables: old name, new name, string length
<varset>("vOldName=_vClpText","")
<varset>("vNewName=_vStrEmpty","")
<varset>("vNumbers=0123456789","")
<var_oper>(vOldNameLength,"%vOldName%",STR_LENGTH,"2","", "0")
<#> Copy all numbers from old name to the new name in the cycle and when the number section ends stop the cycle
<for>("i=0","i<vOldNameLength","1")
<var_oper>(vOldNameChar,"vOldName",STR_GET_CHAR,"i","", "0")
<if_str>("vNumbers~=vOldNameChar")
<var_oper>(vNewName,"%vNewName%",STR_APPEND,"vOldNameChar","", "0")
<else>
<#> End of numbers, append user defined new name and stop the cycle
<var_oper>(vNewName,"%vNewName%",STR_APPEND,"name","", "0")
<for_break>
<endif>
<for_end>
<#> Set new file name
<varout>("vNewName",0) |
IP Logged
|