Skip to content

Instantly share code, notes, and snippets.

@hwada
Created March 30, 2012 06:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hwada/2247937 to your computer and use it in GitHub Desktop.
Save hwada/2247937 to your computer and use it in GitHub Desktop.
namespace CaptureSaver
{
class Program
{
[STAThread]
static void Main(string[] args)
{
if(args.Length == 0) { return; }
var img = Clipboard.GetImage();
if(img == null) { return; }
var dir = args[0];
if(!Directory.Exists(dir)) { return; }
try
{
var file = Enumerable.Range(1, 9999)
.Select(n => Path.Combine(dir, string.Format("Capture_{0}.png", n)))
.First(s => !File.Exists(s));
img.Save(file);
}
catch
{
// (´・ω・`)
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment