Make a usable Variable history "switcher" … just the last 5

I was hoping to get a dirty napkin with some arrows on it and you handed me a gold bar — thank you :blush:.

I didn't know "array variables" from sucking stones. 5★.

I think you've taught me enough not just to fish, but to make nets.

One thing you mention I knew I wasn't sure how to do (others are sure to follow as I knot):

A quick search of this forum brought up one solution: trim with RegEx search and replace, but also turned up setting array elements. Is there a direct (possibly in-built) way to remove an array element by index? I will have to be careful with the delimiter, as you address in your first "Edit" end-note.

As it turns out, for my use I think this will be academic. I need the timestamps for only as long as I am working on a video and I work on only one video at a time and there are never more than a hundred and rarely more than thirty timestamps for any one video. I don't need to save more than the last five — but since the size of the array variable is never going to cause any processing issues, it is simpler, I think, to not bother trimming it — I'll let it grow to include all timestamps for the video being edited, and then clear the array variable before starting on a next video. As is usual, this may provide an opportunity to change my workflow for the better.

My next/first decision is whether to keep the string on one line or to put each timestamp on its own line. I have so often slashed myself on the sharp edges included in \r and \n that I avoid them when I can. Would you say I am likely to regret not using a multiline array?

I will "hard-wire" the collecting of the timestamps into the array, as you suggest.

Nifty! Golden. Thank you.

2 Likes