Plugin: Save Copy As

Browse, download and discuss plugins for Blumentals code editors
Post Reply
User avatar
Aivars
Blumentals Software Developer
Posts: 2462
Joined: Thu Aug 22, 2002 1:40 pm
Location: Latvia

Plugin: Save Copy As

Post by Aivars »

Saves copy of document without affecting the original. Use menu customization to move it under File menu.
Attachments
save copy as.zip
(526 Bytes) Downloaded 1319 times
Blumentals Software Programmer
User avatar
Aivars
Blumentals Software Developer
Posts: 2462
Joined: Thu Aug 22, 2002 1:40 pm
Location: Latvia

Re: Plugin: Save Copy As

Post by Aivars »

Plugin code to use as an example:

Code: Select all

function SaveCopyAs(Sender) {
  var s = Editor.Text;
  var enc = Document.Encoding;
  Documents.NewDocument(ExtractFileExt(Document.FileName));
  Document.Encoding = enc;
  Editor.Text = s;
  Document.Save("");
  Document.Close(True);
}

Script.RegisterDocumentAction("", "Save Copy As", "", &SaveCopyAs);
Blumentals Software Programmer
FrankC
Posts: 126
Joined: Thu Aug 18, 2011 3:28 pm

Re: Plugin: Save Copy As

Post by FrankC »

Nice, it further smooths the work flow. Thanks.
jhonmoral
Posts: 1
Joined: Mon Nov 04, 2013 10:33 am

Re: Plugin: Save Copy As

Post by jhonmoral »

Use menu customization to move it under File menu.
.......Em Crazy..........
User avatar
pmk65
Posts: 678
Joined: Sun Dec 20, 2009 9:58 pm
Location: Copenhagen, Denmark

Re: Plugin: Save Copy As

Post by pmk65 »

Can be simplified by using the build in "Save As.." action, like this:

Code: Select all

function SaveCopyAs(Sender) {
    var fn = Document.FileName;
    Actions.Execute("ActFileSaveAs");
    Document.Filename = fn;
}
Then no extra documents needs to be created. ;)
There are 10 types of people in the world: Those who understand binary and those who don't.
User avatar
Aivars
Blumentals Software Developer
Posts: 2462
Joined: Thu Aug 22, 2002 1:40 pm
Location: Latvia

Re: Plugin: Save Copy As

Post by Aivars »

That might work, except with files opened from FTP.
Blumentals Software Programmer
Post Reply