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

1 Like

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