Loading ...
Sorry, an error occurred while loading the content.

23490Re: [Clip] Re: Would like better way to increment filename by one

Expand Messages
  • Ian NTnerd
    Dec 6, 2012
    • 0 Attachment
      On 7/12/2012 3:58 AM, joy8388608 wrote:
      > ; If size original GT size new, add correct number of preceding zeros
      > ; If same size or smaller, leave var empty
      > ^!Set %INFN_SizeDiff%=^$Calc(^%INFN_Num_of_Orig_Digits% -
      > ^$StrSize("^%INFN_TrailingValue%")$)$
      >
      > ^!If ^%INFN_SizeDiff% <= 0 SKIP_1
      > ^!Set %INFN_Zeros%=^$StrFill("0";^%INFN_SizeDiff%)$
      >
      > ; Create just the filename with the formatted incremented number
      > ^!Set
      > %INFN_NEWFN%=^%INFN_FN_WITHOUT_TrailingNums%^%INFN_Zeros%^%INFN_TrailingValue%
      >
      > ; If they were given, put back the path and extention
      > ^!Set
      > %Incr_FN_O%=^$GetPath(^%Incr_FN_I%)$^%INFN_NEWFN%^$GetExt(^%Incr_FN_I%)$
      > ^!Goto INFN_CLEAR
      Combining your variables with the tip from another post on padding to a
      length, the above could be rewritten as

      ^!Set
      %Incr_FN_O%=^$GetPath(^%Incr_FN_I%)$^$StrCopyRight("00000000000000000000^%%INFN_TrailingValue%%";^%INFN_Num_of_Orig_Digits%)$^$GetExt(^%Incr_FN_I%)$
      ^!Goto INFN_CLEAR

      Ian
    • Show all 13 messages in this topic