- @set @n=0//& dir /b *.txt | cscript.exe -nologo -e:jscript "%~f0" &pause&exit/b
- while (!WSH.StdIn.AtEndOfStream) {
- f = WSH.StdIn.ReadLine();
- WSH.StdOut.Write("\r处理:\t"+f);
- WSH.Sleep(300); //Delete this line!
- try {enlarge(f, 1.5, 2.5); WSH.StdOut.Write("\r成功:\n");}
- catch(e) {WSH.StdOut.Write("\r失败:\n");}
- }
-
- function enlarge(file, m, n)
- {
- var aso, txt;
- aso = new ActiveXObject("ADODB.Stream");
- aso.Mode = 3;
- aso.Type = 2;
- aso.Charset = "cp437";
- aso.Open();
- aso.LoadFromFile(file);
- txt = aso.ReadText(-1);
- if (txt.indexOf('\x00') > -1) {
- aso.Position = 0;
- aso.Charset = "unicode";
- txt = aso.ReadText(-1);
- }
- txt = txt.replace(/\\pos\((\d+),(\d+)(?=\))/g,
- function(s0,s1,s2){return "\\pos(" + s1*m + ',' + s2*n});
- aso.Position = 0;
- aso.WriteText(txt);
- aso.SetEOS();
- aso.SaveToFile(file + ".log", 2);
- aso.Close();
- aso = null;
- return txt;
- }
复制代码
|