Skip to content

Instantly share code, notes, and snippets.

@2no
Last active December 11, 2016 12:06
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 2no/2ce42793a1b02f0025d290c9122dcb0f to your computer and use it in GitHub Desktop.
Save 2no/2ce42793a1b02f0025d290c9122dcb0f to your computer and use it in GitHub Desktop.
var diff,
filePath = '[file path]',
fso = new ActiveXObject('Scripting.FileSystemObject'),
file = fso.getFile(filePath),
date = new Date(file.dateLastModified),
sh = new ActiveXObject('WScript.Shell');
// ペイント起動
sh.run('mspaint ' + filePath);
while (!sh.appActivate('Paint')) {
WSH.sleep(100);
}
// 画像の保存
sh.sendKeys('^s');
// 画像の更新日チェック
do {
diff = date - new Date(file.dateLastModified);
}
while (!diff);
// 更新されていればペイント終了
sh.sendKeys('%{F4}');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment