Processing Ajax...

Title
Close Dialog

Message

Confirm
Close Dialog

Confirm
Close Dialog

Confirm
Close Dialog

Save Copied Image to Disk

Description
If the current item in the clipboard is an image, running this macro will save the image to the disk in the folder you specify in the path variable. By default, the path is set to your Desktop.
Language
C#.net
Minimum Version
Created By
Binary Fortress Software
Contributors
-
Date Created
Aug 19, 2014
Date Last Modified
Aug 19, 2014

Macro Code

using System;
using System.Windows.Forms;

public static class ClipboardFusionHelper
{
    public static string ProcessText(string text)
    {
        string userprofilepath, path, name, filename, time;
        userprofilepath = Environment.GetEnvironmentVariable("userprofile");
        // Update the path below to the folder where you would like the images saved (i.e. path = "C:\\Images\\"; or path = userprofilepath + "\\Pictures\\";))
        path = userprofilepath + "\\Desktop\\";
        name = "ClipboardFusion Saved Picture";
        if (Clipboard.ContainsImage())
            {
                time = DateTime.Now.ToString("(yyyy.MM.dd HH.mm.ss)");
                filename = path + name + " " + time + ".png";
                MessageBox.Show("Saving picture to " + filename, "ClipboardFusion",
                MessageBoxButtons.OK, MessageBoxIcon.Information);
                Clipboard.GetImage().Save (@filename,
                System.Drawing.Imaging.ImageFormat.Png);
            }
        else
            MessageBox.Show ("The clipboard does not contain a picture.",
            "ClipboardFusion", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            return text;
    }
}