DarkMatter in Cyberspace
  • Home
  • Categories
  • Tags
  • Archives

计算总值的Ultraedit脚本


// 使用方法:首先在一个空文本文件总写上需要做和的数字,每个数一行,选中所有数字,然后运行本脚本 var lineTerminator = "\r\n"; var str = UltraEdit.activeDocument.selection; var resultArr = new Array(); resultArr = str.split(lineTerminator); var itemCnt = resultArr.length; var total = 0; for (var i = 0; i < itemCnt; i++) { total = total+parseFloat(resultArr[i]); } UltraEdit.activeDocument.bottom(); UltraEdit.activeDocument.write("\r\n======================\r\n"); UltraEdit.activeDocument.write("Total value is: " + total + " Yuan.\r\n"); UltraEdit.activeDocument.write("Totally "+itemCnt+" items in the list."); //UltraEdit.outputWindow.write("Total value is: " + total + " Yuan."); //UltraEdit.outputWindow.write("Totally "+itemCnt+" items in the list.");



Published

Oct 18, 2010

Last Updated

Oct 18, 2010

Category

Tech

Tags

  • 脚本 5
  • UltraEdit 10

Contact

  • Powered by Pelican. Theme: Elegant by Talha Mansoor