Paste Progressional Numbers Based on Format Name

Hi,

I am trying to set up a macro to take a format name I want like: "EP_103_008_500"

And when I jump to the next file I want it to paste it as EP_103_008_510
and EP_103_008_520 and so on.

So just the last numbers (500 will progress in 10s)

Is this possible?

Thank you,
Av

Anything is possible with KM.

But sometimes questions need clarification. For example, in this case I want to ask what happens when the number hits _990. What comes next?

Thanks for the quick reply :slight_smile:
it should go to 1000 then 1010

Okay I'll have a solution for you in a couple of minutes.

Wow thank you!

You're welcome. It wasn't hard. There are several ways to solve this, I chose a nice way. I created a subroutine which takes no parameters but returns the next string in a variable. Here it is. Just type this in as a new macro. If you have any problems, let me know. I can make changes if you don't like it, but it seems to work quite neatly. For this to work, I assumed that you ensure that the GlobalResult variables begins with the value "50." The first result it will return is "510", then "520". If you wanted it to start with "500" then initialize the value as "49" instead.

I forgot to mention, you call it like this:

image

where VarName is the name of the variable that contains your intended result.

Looks good, but I think I need a bit more guidance here:)
Very new to KM, so if I want the Macro to be:

1- Paste (which will give me "EP_103_008_500"
2- Return
3- Paste (now it will give me EP_103_008_510?)

I will just build this inside the "repeat action" action

How do I do that?

You didn't mention that part of your problem. You did say "when I jump to the next file I want it to paste" but I really didn't know you wanted me to handle that in my solution. I can probably make this work if you give me a couple of minutes. Try doing this:

Underneath the popup name "Select Variable" is the number 50. Sorry about that. Or you can start with 49 if you want the first number to be 50.

Sorry, should have been more clear.
You're great help! I will wait as much as needed:)

Oh rats, I forgot one statement. I'll fix it.

I'm sorry about my mistake. In the macro above, called Name_Paster, change the string "LocalStarting" to "GlobalResult". I'm very sorry for my mistake.

Also, my macro assumes that you have the app open and the cursor in the correct starting location. But to be safe, you could add a statement at the top of my macro to activate your app. Since I don't know what your app is, I can't add that action myself.

Yes the app is open and the file name is marked and ready to pasted.

So which one should I use please?

You should use the variable GlobalResult instead of LocalStarting. Is that what your question means? Also, in order to trigger my macro you may want to assign it a hotkey. Have you done that?

Trying to do build it now :slight_smile:

Getting stuck at the Subroutine, I don't have the ability to select the "Name_Generator"

Most likely that's because you didn't select the following option in the Name_Generator macro: "Executed as a subroutine with parameters". Check that and get back to me.

If you still have trouble after this, I can upload the macros to help you out. But I believe that people learn more when they type the macros in themselves.

Thank you, checking shortly🙏🏻

You are right, defiantly better to learn this way.

Ok I think I am missing something.

  1. When I changed it to "Executed as a subroutine with parameters" I now don't have a hot key to run the it?
  2. Where do I set up the format name? i.e. "EP_103_008_

    "

I asked you to do that on the macro called "Name_Generator" and you change it on the macro named "Name Paster." That is your mistake. Are you willing to try again? I'm glad you like explanations rather than a macro placed in your lap.

I check back every 5 or 10 minutes to see if people have replied to me on this forum. To be honest, I'm binging on Law and Order at this moment.

1 Like

Oh my:) These are 2 Macros :man_facepalming: sorry, I completely missed that fact, lost track of the thread.
Ok I need to create the first Macro. ok trying again now.

Update, I tried to reply to your last reply but I am locked for 19 hours since I am a new user.
So Thought to edit my latest reply with the hope it works.

And I prefer to climb, helicopters are too risky :slight_smile:

I think I am missing something, its launching it after the prompt window but seems

Update 2

Ok fixed all of these, still not starting with pasting, its go straight to "Enter" and "Enter" at least I think it is since "Enter" will load the file on my program.


Update 3
Ok maybe I'll try to explain better this is my application window, it's Avid Media Composer, this is a screen grab of a bin with clips.
When I click on a clip name it's highlighting it just like it would if you click on a folder or a file on the finder on Mac.
The Idea is that when its in "edit mode" I can launch the Macro and it will paste the first instance as the name I want, in this case EP_103_008_500 then when you hit "Return" in this application it jumps to the next clip straight to edit mode and the name is highlighted, so you only need to keep Pasting, but this time it will be EP_103_008_510 then "Return" again. then "Pasting" and it will be EP_103_008_520.

Does that make sense?
Screen Shot 2022-02-28 at 10.31.38 PM

Update 4

Nope, something is off, the first instance is not pasting, its immediately loading the clip, which usually happens when you click "Enter"

Update 5

I think I see the problem
When it launch the Prompt window it's exiting the edit mode form the file, so I lose the ability to paste, then the return will act as Enter.
So I need to lose the Prompt window and keep those settings in the Macro itself and adjust them before I launch it.

Update 6.

Yes we can continue tomorrow if it's getting too confusing with this no problem, if oyu dont respond to this, I will wait till tomorrow, all good, this is all great experience!

I would say that probably removing the prompt window is better, since the only way to get into edit file name mode in this application is with a mouse click and that can get confusing (I did it for another macro, had to take a picture of the icon next to the file name)
But I don't mind instead of prompt window just adjust those 2 "LocalRepeat" and "GlobalResult" in the Macro itself every time before I launch it.

7
Yes, sounds good, thank you again, almost there, much much appreciation!

No problem.

Climbing a mountain is more rewarding than getting a helicopter ride to the top.

(Although I've never climbed a mountain. So I'm speculating.) I just remembered. I climbed a dead volcano once.

Ok, I see your new reply above. I'm reading it.

So far, I've spotted one mistake. You misspelled the word "Variable". I'm still reading for more.

The second mistake that I found is that your last two actions should be inside the loop. You placed them outside the loop. I'm still reading for more errors.

The third mistake is that you misspelled "Variable" in the other macro also. I'm still looking for more errors.

The fourth mistake (but this probably won't be a harmful mistake) is that you didn't remove the parameter from the subroutine. You should press the RED MINUS button to the left of the words: "Local Parameter Name."

At this time I don't see any more mistakes than those. Fix those four and then report what happens, by adding to your last post, since you can't add more posts today.

Okay, it looks like you fixed the bugs I spotted. Now I'm trying to determine what it's doing wrong. But it's hard to be sure since I can't see your application or browser window. I'm still trying to figure out the issue. The problem might be that I misunderstood what you wanted to do. Give me a minute.

1 Like