Last active
December 20, 2015 19:58
-
-
Save ayweak/6186607 to your computer and use it in GitHub Desktop.
Artistic Style をクリップボードに使いたいようなそんな感じ。
mshta と JScript を利用。
This file contains hidden or 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
@rem -*- coding: shift_jis-dos -*- | |
@echo off | |
set ASTYLE="AStyle.exe" --mode=c -n --style=kr | |
for /f "usebackq" %%s in (`mshta "javascript:var text = clipboardData.getData('text');var fso;var tmpfilename;var tmpfile;if (text) {fso = new ActiveXObject('Scripting.FileSystemObject');tmpfilename = fso.GetTempName();tmpfile = fso.CreateTextFile(tmpfilename);tmpfile.Write(text);tmpfile.Close();fso.GetStandardStream(1).Write(tmpfilename);}close();"`) do set tmpfilename=%%s | |
rem var text = clipboardData.getData('text'); | |
rem var fso; | |
rem var tmpfilename; | |
rem var tmpfile; | |
rem | |
rem if (text) { | |
rem fso = new ActiveXObject('Scripting.FileSystemObject'); | |
rem tmpfilename = fso.GetTempName(); | |
rem tmpfile = fso.CreateTextFile(tmpfilename); | |
rem tmpfile.Write(text); | |
rem tmpfile.Close(); | |
rem fso.GetStandardStream(1).Write(tmpfilename); | |
rem } | |
rem | |
rem close(); | |
if "%tmpfilename%" == "" exit /b | |
%ASTYLE% "%tmpfilename%" | |
mshta "javascript:var fso = new ActiveXObject('Scripting.FileSystemObject');var tmpfilename = '%tmpfilename%';var tmpfile;var text;tmpfile = fso.OpenTextFile(tmpfilename, 1);text = tmpfile.ReadAll();tmpfile.Close();clipboardData.setData('text', text);close();" | |
rem var fso = new ActiveXObject('Scripting.FileSystemObject'); | |
rem var tmpfilename = '%tmpfilename%'; | |
rem var tmpfile; | |
rem var text; | |
rem | |
rem tmpfile = fso.OpenTextFile(tmpfilename, 1); | |
rem text = tmpfile.ReadAll(); | |
rem tmpfile.Close(); | |
rem clipboardData.setData('text', text); | |
rem | |
rem close(); | |
del "%tmpfilename%" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment