📜 ⬆️ ⬇️

A convenient way to take screenshots under MacOSX

Disclaimer: This article has practical meaning only for Mac users. The rest - except for the sake of illustrating the capabilities of MacOSX.


One of the very frequent use cases for many people using computers is the creation and placement of screenshots.

How often do you need to show someone a part of your screen, a window of an application, a “photo” of an error or something funny? The correct answer is more often than you do. Because usually all this is quite difficult and uncomfortable. Indeed, what should be done for this:
')
1. Actually, take a screenshot.
2. Save it to a file.
3. Post somewhere on the Internet.
4. Get an http link to it.
5. Give it to someone you need.

The implementation of each of the items (except the fifth except) is often not as simple as we would like.

I want to talk about how to quickly create screenshots, which is useful, as it seems to me, to many.

Automator


MacOSX, starting with version 10.4, includes a rather interesting and powerful application - Automator. If you try to describe its functionality in a single sentence, then it is a tool for creating not too complex scripts from a pre-installed (but expandable) set of “bricks” - separate atomic actions.

Each action is some kind of operation that has (though not necessarily) some input and output data. Given the type of this data, actions can be organized into a linear flow, in which each next action receives input data from the output of the previous one. Thus, a sequence of operations is formed, leading to the desired result.

However, it will be much easier to set an example.

This is what the Automator window looks like:



The Library panel lists all the applications that provide Automator with action sets. On the Action panel, respectively, the actions are located.

From the actions we can make a program (Workflow). For example, such:



This “program” copies all unread mail to the iPod in the form of text notes (standard iPod functionality). It is unlikely that someone really needs it, but for example, it will do. So:

1. We ask for confirmation from the user - is he ready for action (has he connected an iPod)?
2. Download new mail for all accounts.
3. We request from the mail program all letters that have not yet been read.
4. Combine letters into one big text piece.
5. Create a text note in the iPod.

Very simple, very visual and very fast.

But back to our task.

Implementation


So, we want to create something that allows you to quickly (with one click) take a screenshot of any part of the screen, upload it to an FTP server and put a link to the clipboard to the HTTP address of this image.

Actually, the script:



In steps:

1. Use the standard action “Take screenshot”. With the specified settings, it will prompt the user to select any area of ​​the screen with the mouse and save the image selected to the screen file.

2. This action renames this file to a unique name. It is necessary so that the next screenshot does not overwrite the previous one.

3. Actually, upload to FTP. This action is not standard and needs to be installed separately into the system. Below the article will be given all the links.

4. The “Upload to FTP” action sends an HTTP link to the uploaded file in the output. The fourth action, we put it on the clipboard.

Everything!

Dry residue


Here is the actual archive of the finished workflow that does what is described in this article: screenshot.zip .

Here is the action “ Upload to FTP ” necessary for its work.

Instructions:

1. Download and install “Upload to FTP”.
2. Open screenshot.wflow in Automator. Replace the parameters of the first and third actions. In the first step, choose the appropriate place for saving the screenshot, in the third enter all the necessary parameters of your FTP server.
3. Choose the menu item File - Save As ..., then instead of the type “Workflow” choose “Application”.

Now you have the usual MacOSX application, which you can put in the Dock and run every time you need to take a screenshot.

Hooray!

Source: https://habr.com/ru/post/15163/


All Articles