Trigger screenshot of area, then do something

Similar to this action:

I want to trigger screenshot selection area then in same macro, after selection was done, paste it instantly in some app (in my case its ChatGPT.app).

How can I do this? I don't think I can do this but hopefully I am wrong. :pray:

How are you defining the area? While you consider that, take a look KM's "Screen Capture" action.

1 Like

You can do it, but it's a bit tricky; see the Wiki page on Screen Capture for all the details, but the net of it is that you need to use a shell script:

screencapture -ic

That will let you capture a region to the clipboard, then you can paste it elsewhere.

-rob.

1 Like

above is perfect, thanks

although one thing it lacks is how to check that if no screenshot was taken from selected area, it should abort

I want to avoid doing this mess but seems I am forced to?

Here's one alternative, an If-Then right after the screenshot:

Or check for no image, based on how you want to structure your macro.

This won't help if there's already an image on your clipboard, so you can fix that by adding a Set Clipboard to Text (put whatever you want in it, of course) action at the start of the macro. That way, the screenshot will either be there, or it will be text, and your If-Then test will work.

-rob.

1 Like

Works perfectly, so good

Thanks

1 Like

Do it the other way round -- save CLIPBOARDSEED() immediately before the screen shot shell script action, then check if it has changed immediately after. That way it doesn't matter what was on the clipboard before, you can continue the macro only if it has changed.

1 Like