Fast way to watch for screen snapshot, prompt to rename

For a very, very long time, I've been using an AppleScript plugged into an Automator workflow that watches my Desktop folder constantly for new screen snapshots, then when one appears, prompts me to enter a custom name for it. I rely on this a lot, but it takes several seconds for the prompt to appear. How can I make a new fast one using KM? Thanks.

Hey Laine,

Using a Folder Trigger to Prompt Renaming and Moving New Screenshots

Read the whole thread, because the gotcha of screenshots is the invisible file that gets renamed.

-Chris

2 Likes

Thanks, I will read it. I'm sure I searched for the topic, but I didn't use the term screenshot in my search. That's problematic for me (also the fact that I confuse semaphores with sophomores).

OK, I simply transcribed the AppleScript I had been using so that it's run from a KM trigger instead of a folder action. That solves the delay problem and now I'm prompted for the new file name almost instantly. I'm not aware of any problems with the macro, but I'm getting an error message from KM (maybe related to the caveat you pointed out, I guess, Chris):

Macro Cancelled
Execute an AppleScript failed with script
error: text-script:181:196: execution error:
File /[Users/me/Desktop/.Screen Shot
2022-01-27 at 3.28.48 AM.jpg wasn't
found. (-43). Macro “Desktop Folder
Screen Snapshots” cancelled (while
executing Execute AppleScript).

How can I suppress this error, do I just live with it, or do I need to heed it? I'll be happy to upload the macro, which I haven't done in a while, but I know that it's customary to follow a procedure that I'm not very familiar with, so I'll be looking it up. Thanks.

Still working on this, but in the meantime, here's an AppleScript to take a screen snapshot on your clipboard and make it a graphic file on the desktop, pretty much what ⇧⌘3 did in legacy versions of the System.

If you trigger it using ⇧⌘3, it should do that, with the exception that it uses your system clipboard.

A pause might be needed under some circumstances.

Take your pick between .jpg and .png.

set now_stamp to do shell script "date \"+%Y-%m-%d at %H:%M:%S\""
tell application "System Events" to ¬
   write (the clipboard as JPEG picture) to ¬
      (make new file at desktop folder with properties ¬
         {name:"Screen Shot" & space & now_stamp & ".jpg"})

or

set now_stamp to do shell script "date \"+%Y-%m-%d at %H:%M:%S\""
tell application "System Events" to ¬
   write (the clipboard as «class PNGf») to ¬
      (make new file at desktop folder with properties ¬
         {name:"Screen Shot" & space & now_stamp & ".png"})

Sorry, you'd need to trigger the above with ⌃⇧⌘3 to make it do what ⇧⌘3 used to do. Anyway, it could be useful if you wanted to quickly get an image out of your clipboard and onto the Desktop without launching any applications.

(Even that depends on your Mission Control settings, of course)

Better late than never, I hope. Thanks.

1 Like

Something has changed since Sequoia 15.3 that broke my solution. Is there a chance you know what it is? I'll work on it, but if you can help, please offer suggestions. Thanks again.

Which solution? There's a couple of different ones, with different purposes, in this thread.

I posted an alternative approach in a new thread, as it's a completely different method that may inspire different conversations, so I didn't want to pollute this thread:

-rob.

Thanks, Rob. I'm considering posting my macro, but I'll try yours first. I've not posted a macro, at least not recently enough that I remember how, but I seem to remember that a bit of learning is needed to do it. I'm also concerned that I used to be able to take screen snapshots more easily, because I seem to remember that I could just press return or enter after the thumbnail appears. Now I have to click it, then click done. Is that my imagination? Thanks again.

Try the one I just posted, it works around all of that.

-rob.

Do you even need that thumbnail? I always turn if off -- Screenshot's Options pop-up, uncheck "Floating Thumbnail".

Apologies for the shonky picture -- turns out to be "quite interesting" getting a screen shot of the screen shot program :wink:

1 Like

OMG I never even knew that was there! Disable that, and you can use the built-in tools with the folder watcher, and it's instantaneous, just like the replacement I wrote.

Just for the fun of it, here's the version I wrote using the built-in tools:

Rename screenshot - traditional.kmmacros (4.7 KB)

It doesn't have a fancy name-conflict checker; I mainly wrote it to see what was up with the solutions posted here. But with the floating preview disabled, this is super fast.

-rob.

I'm thankful there have been replies other than those made to my specific issue, because my problem has been solved, and that takes a little of the attention away from my embarrassment. What actually occurred in my case was that an inadvertent and unnoticed accidental cursor drag apparently moved the macro for setting the variable to a position from which it worked after the macro that attempted to use it. This accident didn't occur through complacency, I assure you. It's just that I'm getting old, reaction speeds aren't what they once were, and I simply didn't notice it when it occurred. Not imagining that such a thing could happen, I looked for other causes first. Apologies, and thanks again! This reply may not be sufficient, but it is honest.