Macro Snip

Description
Use this macro to easily post screenshots to the FreeCAD forum.

It is best to add this macro to your global custom macros toolbar for quick and easy access.

When posting to the FreeCAD forum it is often useful to be able to include screenshots. The problem is this is a somewhat tedious task. This macro therefore aims to make that task a bit easier.

Usage
The macro can take screenshots or it can use existing screenshots that have already been copied to the system clipboard. To bypass the image already in clipboard press the key while invoking the macro. To use the macro to take the screenshot adjust the size and placement of the dialog that pops up, then click. Upon clicking the macro will attempt to take a screenshot of the area of the screen covered by the dialog. The dialog itself is semi-transparent, so you can see the contents beneath.



After clicking, the macro then takes the screenshot and saves it to a temporary file. A file open dialog is then opened at the file's location. You can drag and drop the file from there to the forum into the textarea where you type in your text for your forum post. Upon canceling the dialog the temporary screenshot file is deleted automatically. You may also open the screenshot file in your default application installed for opening files (on Windows this is typically Paint). This can be useful if you wish to add some annotations to the screenshot or perhaps additional editing, such as cropping.



If the macro doesn't work on your system to capture screenshots it can still be useful for screenshots you have captured using other tools. Simply copy the screenshot to the clipboard, then run the macro. It will create the temporary file and open the file's directory in an open file dialog for you. Some other tools for taking screenshots:


 * Windows: Windows Key + +
 * MacOS: +  +
 * Linux: gnome-screenshot utility

Parameters
The Macro supports user parameters, which can be set using


 * ,, , : location and size of snip box last use
 * (0.85): a value between 0.0 (less opaque) and 1.0 (more opaque)
 * (0.5): time (in seconds) delay between snip box close and snip
 * (0): desired width (in pixels), ignored if 0 -- scales image to desired with keeping current aspect ratio
 * (1.0): desired scale factor, (overrides DesiredWidth if ScaleFactor is not 1.0) -- scales image to scale factor

The parameters are reset by the macro each time it is run. This is how it keeps track of where to place the snip box, which is the last place it was when the user took a screenshot.

The parameter is the opacity of the snip box.

The parameter can be adjusted to speed things up a bit, but if the value is too small the screenshot taken might include the snip box itself because there needs to be duration of time to close the dialog before taking the screenshot.

The parameter scales the image to the desired width unless it is 0 (the default) in which case no scaling is done. For example, if you set the desired width to 800 then you will get images that are 800 pixels wide. The height will be automatically scaled to maintain the current aspect ratio. If the original image was 1600x1200 and the DesiredWidth is 800, then the resulting image will be 800x600.

The parameter scales the image to the desired ratio, e.g. 0.5. The default is 1.0, in which case no scaling is done. This overrides the DesiredWidth parameter if ScaleFactor is not 1.0.

You can bypass all scaling by holding down the Ctrl key while clicking the Ok button to take the screen shot.

Script
ToolBar icon

Macro_Snip.FCMacro

Link
The forum discussion Snip macro