The script below closes current file with some additional behaviour: if closed
file was last, script closes PSPad window too.
// JavaScript Document
//******************************************************************************
*
// filename : SmartClose.js
// description: Smart file closing
// created : 13.12.2007
// author : Michael Vlasov
//
// You may distribute this script freely, but please keep this header
intact.
//******************************************************************************
*
var MODULE_NAME = "SmartClose";
var MODULE_VER = "1.0";
var MODULE_TITLE = "Close current file and PSPad if no files opened.";
function Init() {
menuName = "&" + MODULE_NAME;
addMenuItem(menuName, "", "main", "ESC");
}
function main() {
var count = editorsCount();
var ed = newEditor();
ed.assignActiveEditor();
if(ed.closeFile()) {
if(count <= 1) {
var shell = new ActiveXObject("WScript.Shell");
shell.SendKeys("%{F4}");
}
}
}
--
<http://forum.pspad.com/read.php?2,35782,44128>
PSPad freeware editor http://www.pspad.com