23486Re: [Clip] Re: Would like better way to increment filename by one
- Dec 4, 2012On 5/12/2012 6:46 AM, joy8388608 wrote:
>Sorry my last post had junk in it. Let me know what you think. I'd like
> Very interesting thoughts from everyone and I'm kind of happy that
> there have been no "why didn't *I* think of that" answers so far.
> To clarify some things...
> "bkup" was just an example. I want a routine that works with any and
> all file names.
> For this same reason, starting numbering with 10000 and using an
> underscore to make the number easier to find is not an option.
> I do very much agree with Axel in that clear, plodding code that can
> be easily understood is usually better than shorter, "clever" code
> that is difficult to follow. That and lots of comments! Anyone who has
> had to modify other people's code know what I'm talking about.
> Other languages have numeric formatting and special commands that
> would make this easy but NT does not. So, for now, I think what I have
> is the best I've come across unless someone comes up with an idea. My
> code is not available to me at this moment but I'd be happy to post
> what I have later if anyone has an interest. Just ask.
> I'll be still thinking about this one.
to see what you have now.
; Get the file name (no path or extension)
; start loop from ClipHelp.clb
^!If ^%Index% > ^%LoopCount% EndLoop
; test if the string that is ^%index% chars long is a number if not end loop
^!if ^$IsNumber(^$StrCopyRight("^%input%";^%index%)$)$=0 endloop
; create a string of zeros to be longer than needed
; return to ClipHelp.clb closing section
; test if the ^%index% is 1, if it is then there is no number at the
end. Do nonumber else do has number.
^!if ^%index%=1 nonumber else hasnumber
; if no number create the string to return
; if number found, decrease the index to the correct figure.
; get the non number part of the string
; get the number part and increase it by one
; set the return value with alpha part and new number trimed to the
; this will fail if your input string is 99 and it is increased to 100
^$incfile(^?[Word to use=word0101010108])$
[Non-text portions of this message have been removed]
- << Previous post in topic Next post in topic >>