Hy, I have a simple macro that does some mouseclicks and typing a text. When I start the macro for the first time and set the Repeat Actions to 10 times everything is ok. But when I change the Repeat Actions to 12 than the macro runs again for 10 times.
What did I wrong? Can you help me please?
Thanks a lot
Kind Regards
Save E-01.kmmacros (11.3 KB)
Hallo, the macro you uploaded is set to repeat 500 times. I tested it for 500, 10, and 12 repeats, and all successfully completed the correct number of times. Just to double-check, is this the actual macro that you're having a problem with? If so, does the engine log say anything that might be helpful?
Hy, thanks for your answer. Yes, this is the actual macro.
In the Enginge.log file there is no entry for today. But in the Editor.log there is an entry for today:
2025-01-02 14:33:38 Failed to find any 1Password metadata folder or bookmarks-default.json file
Does this help?
Thanks
Hm, I'm afraid the editor.log won't be helpful in diagnosing why your macro isn't executing as expected. Have you already tried running this macro today? If not, try running it as you normally would, and then look at the engine.log in the event it fails to complete all the set repetitions successfully. You can post the line item/s from the log here; it may or may not give us any clues. It might be that we'll need to see what's actually happening for you in a screen recording. Then again, I see Airy typing, and they might have a great deal more insight than I.
If you changed it from 10 to 12 and then immediately triggered it without waiting a couple of seconds for the Editor to save the changes, then the Engine would be using the older version with the 10 in it.
I was able to get the same result as you by pressing the hotkey quickly after changing the code. That could be what happened to you, but I can't be sure, because I didn't see what you did. If this is what you did, then the solution is to wait a couple of seconds after editing the macro before running it. This is how KM is designed. The Engine doesn't instantly know about what the Editor has done. It takes a couple of seconds.
A better solution is not to hardcode the numbers 10 and 12, but to ask the user with a Prompt action what number he wants. This would also solve the problem.
Hy Airy,
I tried the following before I was reading your post:
type in the number of repeats, press enter, type the number again and press enter again. This seems to work.
What is a prompt action? Sorry for asking
This is the Prompt for User Input action:
If you used this in your macro, then the user would input the number of repeats, which would be stored in the Global Variable "NumberRepeats", which you could then use in your Repeat action like this:
So you see, you can ask the user how many times to repeat, and then your macro can repeat that many times.
As for the first part of your post, I didn't understand it, but you said it "seems to work" so I don't need to understand it.
Thanks a lot for your help. I will try it.
Kind Regards
Before going much further -- it's difficult to know, because of the reliance on mouse clicks at absolute coordinates, what your macro actually does.
You seem to be entering a value somewhere, that value incrementing with each loop. There may be a better way of doing what you want -- a way that will be both less fragile (what will happen if your Excel window is in a different position?) and considerably faster.