- @set @n=0;/* & echo off
- cscript -nologo -e:jscript "%~0" > mapfile.txt
- pause & exit/b & rem */
-
- path = WScript.ScriptFullName.replace(/(.*?)[^\\]+$/, "$1");
- oExcel = new ActiveXObject("Excel.Application");
- oBook = oExcel.WorkBooks.Open(path + "wxd.xls");
- oExcel.Visible = false;
- oExcel.WorkSheets(1).Activate;
- row = oExcel.ActiveSheet.UsedRange.Rows.Count;
- sZH = "zh{\r\n";
- sEN = "en{\r\n";
- for (i=1; i<=row; i++) {
- sKey = oExcel.Cells(i, 1);
- sZH += sKey + ':="' + oExcel.Cells(i, 2) + '",\r\n';
- sEN += sKey + ':="' + oExcel.Cells(i, 3) + '",\r\n';
- }
- oBook.Close(); oExcel.Quit()
-
- sZH = sZH.replace(/,\r\n$/, "\r\n}");
- sEN = sEN.replace(/,\r\n$/, "\r\n}");
-
- WScript.Echo(sZH + "\r\n" + sEN)
复制代码
|