Macro Creates Two Prompts When There Should Be Only One

The following macro is designed to work with screen shots using a user prompt. For some reason, it's creating two simultaneous prompts on top of each other [see attached gif], and I can't figure out why this is.

Any thoughts?

Open screen shot v1.1.kmmacros (6.8 KB)

two_prompt_windows

Hi @paulcristo, I tried out your macro and it works without any problem on my system.

I did get to replicate your problem, however, by having two copies of your macro (in other words, I just duplicated your original macro). That way it was firing twice.

I couldn't find any other way of getting the problem to happen.

So - do you have another copy of your macro (maybe version 1.0 that you haven't disabled) somewhere?

KM 0 2021-07-13_17-02-34

Hey Paul,

Turn on debugging and run your macro.

It's running twice.

If you turn on:

image

It only runs once.

So it would appear that the macOS screenshot mechanism is writing a temp-file before writing the final file to the Desktop.

Unfortunately “ignore partial or changing files” makes the macro painfully slow.

Yep...

Open screen shot.ccstone v1.00.kmmacros (2.4 KB)

/Users/chris/Desktop/.Screen Shot 2021-07-13 at 10.55.27.png
/Users/chris/Desktop/Screen Shot 2021-07-13 at 10.55.27.png

Set your macro to ignore file names starting with a dot, and you should be able to get rid of the ignore bit and speed up the macro. Something like this:

Open screen shot.ccstone v1.00.kmmacros (3.4 KB)

-Chris

2 Likes

Hi, Chris.

Thank you for the help. That seems to have worked! Would you mind walking me through the regex you coded? I tried plugging it into regex101.com and it doesn't like the syntax.

H

Hey Paul,

It doesn't like the syntax, because it uses forward slashes as delimiters. Change the delimiters to something else, and it'll work.

/Users/chris/Desktop/.Screen Shot 2021-07-13 at 10.55.27.png
^.+/\.[^/]+$
^		==  Beginning of line.
.+		==  Any character one or more.
/		==  Literal “/” with above it's greedy and will find until the last match.
\.		==  Escaped dot (. is a reserved character and must be escaped to user as a literal).
[^/]+	==  Any character NOT “/” one or more.
$		==  End of line.

-Chris

1 Like

Hey Taj,

I forget – what version of Mojave are you using?

At the moment I'm using Mojave, and it appears to change the way screenshots are saved. (I was using Sierra previously.)

-Chris

I'm on 10.14.6, Chris.

Same here, but I immediately had the same problem as Paul.

Odd...

-Chris

That is odd isn’t it? My immediate thought was to look for a temporary file but I didn’t find one like you did which is why I thought it might be two macros triggering. Maybe I’ll take another look tomorrow when I get time! Cheers, Taj.

I've had another very careful look at this and on my system it now triggers 4 times for each screen shot.
KM 0 2021-07-15_00-59-51

As you said @ccstone, changing the trigger to ignore partial or changing files fixes the problem.

I can't actually say why it was working properly yesterday! More thumbs than fingers probably...