Created
July 3, 2014 01:37
-
-
Save mlabrum/20d454ca8d334e62a378 to your computer and use it in GitHub Desktop.
Image saving Clipboard Fusion Macro + Save Dialog
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Windows.Forms; | |
public static class ClipboardFusionHelper | |
{ | |
public static string ProcessText(string text) | |
{ | |
string name = "ClipboardFusion Saved Picture"; | |
if (Clipboard.ContainsImage()) | |
{ | |
string time = DateTime.Now.ToString("(yyyy.MM.dd HH.mm.ss)"); | |
// Create the dialog | |
SaveFileDialog saveFileDialog1 = new SaveFileDialog(); | |
saveFileDialog1.InitialDirectory = Convert.ToString(Environment.SpecialFolder.Desktop); | |
saveFileDialog1.Filter = "png (*.png)|*.png" ; | |
saveFileDialog1.FilterIndex = 1; | |
saveFileDialog1.FileName = name + " " + time + ".png";; | |
// User clicked ok | |
if(saveFileDialog1.ShowDialog() == DialogResult.OK) | |
{ | |
string filename = saveFileDialog1.FileName; | |
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; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment