今までは以下のやり方をしていました。
プリントスクリーン→ペイント起動→Ctrl + V→Ctrl + S→名前を入力して保存わりと面倒です。名前が重複しないように気を付けることとか、ペイントを他の用途で使って保存先フォルダの表示が変わると保存後のファイルを使う時や後始末する時に面倒だと感じます。
以下の方法で複数の画像を保存し、用が済んだらウィンドウを閉じるだけで勝手に削除されるようにするプログラムを作成しました。
一時フォルダを開く→「+」ボタンを押してpngファイルを追加→pngファイルを右クリック→Eキーでペイント編集開始→Ctrl + V→Ctrl + S
実行画面

以下ソース
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
vbs=function(){ | |
var sc=new ActiveXObject('ScriptControl') | |
sc.Language = 'VBScript' | |
sc.AddCode((function(){/* | |
F GetTypeName(obj) : GetTypeName = TypeName(obj): EF | |
F vbMsgBox(str, buttons, title) : vbMsgBox = msgbox(str, buttons, title): EF | |
F vbInputBox(str, title, default) : vbInputBox = inputbox(str, title, default): EF | |
F getAdminMembers(pcName) | |
Dim objGroup, objUser, str | |
set objGroup = GetObject("WinNT://" & pcName & "/Administrators") | |
str = "" | |
For Each objUser in objGroup.Members | |
str = str & objUser.Name & vbLf | |
Next | |
getAdminMembers = str | |
EF | |
Class TerminaterClass | |
Public funTer | |
Private Sub Class_Terminate: funTer: End Sub | |
Public Sub setF(f): set funTer=f: End Sub | |
End Class | |
F getTerminater | |
Set getTerminater = New TerminaterClass | |
EF | |
Sub a(f) | |
dim b | |
set b = New TerminaterClass | |
b.C(f) | |
msgbox 1111 | |
End Sub | |
*/}+'').split('/*')[1].split('*/')[0].replace(/(\s)EF(\s)/g,'$1End F$2').replace(/(\s)F(\s)/g,'$1Function$2')) | |
return { | |
sc:sc, | |
msgbox:function(prompt, buttons, title){ | |
// [buttons] | |
// 0:OK、 1:OK・キャンセル、 2:中止・再試行・無視、 3:はい・いいえ・キャンセル、 4:はい・いいえ、 5:再試行・キャンセル | |
// 0x10:警告メッセージアイコン, 0x20:問い合わせメッセージアイコン、0x30:注意メッセージアイコン、 0x40:情報メッセージアイコン | |
// 0:第1ボタンを標準ボタン、 0x100:第2ボタンを、 0x200:第3ボタン、 0x300:第4 | |
return sc.Run('vbMsgBox', prompt, buttons, title) | |
}, | |
inputbox:function(prompt, title, def){return sc.Run('vbInputBox', prompt, title, def)}, | |
getAdminNames:function(PC名){var arr=sc.Run('getAdminMembers', PC名).split('\n'); arr.pop(); return arr}, | |
setTerminate:function(fun){ | |
var obj=sc.Run('getTerminater') | |
obj.setF(fun) | |
return obj | |
} | |
} | |
}() | |
AXO = function(n){return new ActiveXObject(n)} | |
fs = AXO('Scripting.FileSystemObject') | |
shell = AXO('WScript.Shell') | |
pathTMP = fs.GetSpecialFolder(2)+'\\'+(new Date()).getTime() | |
pathHTA = pathTMP+'.hta' | |
fs.CreateFolder(pathTMP) | |
ws = fs.CreateTextFile(pathHTA) | |
ws.Write((''+function(){/* | |
<html> | |
<title>一時フォルダ</title> | |
<style type="text/css"> | |
.max{width:100%;height:100%} | |
.w-max{width:100%} | |
</style> | |
<body> | |
<table class=max> | |
<tr height=1> | |
<td> | |
<table class=w-max> | |
<td><input id=inp class=w-max value="-path-"></td> | |
<td width=1><button id=btn>開く</button></td> | |
<td width=1><button id=btnAdd>+</button></td> | |
</table> | |
</td> | |
</tr> | |
<tr><td><iframe id=ifr class=max style="border:solid 1px #000" src="-path-"></iframe></td></tr> | |
</table> | |
</body> | |
<script> | |
resizeTo(400,400) | |
btn.onclick=function(){ | |
path = inp.value | |
;(new ActiveXObject('WScript.Shell')).run(0<path.indexOf(' ') ? ('"'+path+'"') : path) | |
} | |
fs = new ActiveXObject('Scripting.FileSystemObject') | |
btnAdd.onclick=function(){ | |
var i=0, path=inp.value, path0 | |
while(fs.FileExists(path0=path+'/'+i+'.png')){ i++ } | |
fs.CreateTextFile(path0).Close() | |
} | |
</script> | |
</html> | |
*/}).split('/*')[1].split('*/')[0].replace(/-path-/g,pathTMP)) | |
ws.Close() | |
while(true){ | |
shell.run(pathHTA, 1, true) | |
if(vbs.msgbox('['+pathTMP+']を削除します', 1, '一時フォルダ')!=2){break} | |
} | |
fs.DeleteFolder(pathTMP) | |
fs.DeleteFile(pathHTA) |
0 件のコメント:
コメントを投稿