Page 1 of 1

Add "Save Copy As..." to File Menu

Posted: Thu Jan 22, 2004 2:22 pm
by Bonzo
I'm not sure if this has been mentioned before or not, but its a simple one, that comes in handy all the time.

Purpose: It saves a copy of the current document, to a new file, which is opened. This way, the original file, is still open, and the new file is editable too.

I have a macro right now, to attempt to emulate this...
CTRL+A //select All
CTRL+C //copy to the clipboard
CTRL+N //create a new Document
CTRL+S //save new Document (which prompts for a name)

The problem is, it *kills* my clipboard contents... (very undesired)

As another potential solution, I would be happy with the ability to assign some "content" to a variable, in Macros, that I can "get" latter in a macro...

In fact, this would be a very desirable addition to macros in genera. :-)

Posted: Thu Jan 22, 2004 5:09 pm
by talleyrand
Funny, I still have all the contents in my clipboard history (clip library) after doing Ctrl-A, Ctrl-C, Ctrl-N & Ctrl-S.

Mis-Understanding...

Posted: Thu Jan 22, 2004 5:55 pm
by Bonzo
I should clarify...

Just because I want to "Save a copy as...", does not mean I want to wipe out my clipboard contents... (with a copy of my current document), which the CTRL+C will do...

e.g. if I have "<a href="someRealyCoolWebsite">Go</a>" on the clipboard...

When I invoke my Macro (described above)... I want to save a copy of the current document, *BUT* I don't want to overwrite, the previously set content on the clipboard.

Cheers,

Bonzo

Posted: Thu Jan 22, 2004 7:43 pm
by CyberSlug
I see two options:

1) Backup the clilpboard to a temporary document buffer and restore it after completing the operation you descripbed:
Ctrl+N //new blank doc (buffer)
Ctrl+V //paste clipboard
Ctrl+Tab //go back to original doc

Ctrl+A, Ctrl+C, Ctrl+N, Ctrl+V, Ctrl+S

Ctrl+Tab (twice?) to get back to the buffer
Ctrl+A, Ctrl+C //retrieve original clipboard contents
Ctrl+F4 //to close the temp buffer

Figuring out the correct number of times to Ctrl+Tab depends on whether you keep your saved document copy open or not.

2) Use third-party macro utilities. Here's one possibility using AutoIt v3 Bob or someone else might recommend other software such as MacroMagic.

Code: Select all

$bak = ClipGet()  ;backup clipboard

WinMenuSelectItem("TextPad","", "&Edit", "&Select All")
WinMenuSelectItem("TextPad","", "&Edit", "&Copy")
WinMenuSelectItem("TextPad","", "&File", "&New")
WinMenuSelectItem("TextPad","", "&Edit", "&Paste")

WinMenuSelectItem("TextPad","", "&File", "Save &As...")
ClipPut($bak)  ;restore clipboard
To use, install AutoIt, save the code in an AutoIt file, then compile it. Set the compiled executable as a user-defined tool in TextPad, and optionally put it on your toolbar or assign a hotkey to it.
An alternative AutoIt script is this:

Code: Select all

$bak = ClipGet()
Send("^a^c^n^v^s")  ;the ^ means Ctrl
$bak = ClipGet()