Hi,

I have tried, using the extensions find on your site, to create a script that
does the job :

cite:
--------------------------------------------------------------------------------
var module_name = "CopySaveSelec";
var module_ver = "0.01";

function CopySaveSelec()
{       
  var thisdoc = newEditor();
  try {
                thisdoc.assignActiveEditor();
        } catch(e) {
                echo("Sans document ouvert, une copie est impossible.");
                return;
        }
  var newdoc="";
  var dat = thisdoc.selText();
  var intLen = dat.length;
    
  var newdoc = newEditor();
  if (intLen == 0) {
           echo("Selectionner du texte s'il vous plait...\t");
        }  
  else {
        newdoc.newFile();
        newdoc.Text(dat);
        newdoc.fileName("nouveau Document");
    
/* 3 lignes ajoutees pour sauvegarder le document */
        var wsh = new ActiveXObject("WScript.Shell");
        wsh.sendKeys("^{F4}");
        wsh.sendKeys("~");
        }
}

function Init(){
  addMenuItem("Copier et sauver la selection", "", "CopySaveSelec");
}
--------------------------------------------------------------------------------

- Using the 3 lines with WSH permits to save the selection but the file name is
not saved in the _Open Recent files list_.

- Without these 3 lines, if i do a "_File / Close_", a question asks the
file name, then the file is saved but the file name is also not added in the
list.

- Without the 3 lines, if i use the "_File / Save_", then save is made
asking the filename that is then added in the _Open Recent files list_.
:-P

Can you help me to have the coding to be used to have automaticaly the good
working in a script without doing manually a "_File / Save_" ?

Best Regards ;-)

-- 
<http://forum.pspad.com/read.php?2,31916,32598>
PSPad freeware editor http://www.pspad.com

Odpovedet emailem