world.SaveNotepad

MUSHclient script function (Method) — introduced in version 3.29

Saves a notepad window to disk

Prototype

long SaveNotepad(BSTR Title, BSTR FileName, BOOL ReplaceExisting);

Data type meanings

Description

This saves an existing notepad window to disk.

Title - title of the notepad (used in functions like AppendToNotepad)

FileName - name to save to disk as.

If the file name is empty (ie. "") then it will be saved under its existing file name, if any, or you will be prompted for the name to save it as.

ReplaceExisting:

If true - the specified file name becomes the "default" file name for the file. In other words, if you subsequently save from the GUI interface it will automatically use that file.

If false - saves the file under the name you specify, however the "default" file name is unchanged.

WARNING - if a file of the same name exists on disk it will be overwritten, regardless of the ReplaceExisting flag value.

SECOND WARNING - versions 4.13 and earlier of MUSHclient returned 0 on a good save and 1 on a bad save. From version 4.14 onwards it returns 0 on a bad save and 1 on a good save.

VBscript example

world.SaveNotepad "my_notepad", "c:/mushclient/notepad.txt", 0

Jscript example

world.SaveNotepad ("my_notepad", "c:/mushclient/notepad.txt", 0);

PerlScript example

$world->SaveNotepad ("my_notepad", "c:/mushclient/notepad.txt", 0);

Python example

world.SaveNotepad ("my_notepad", "c:/mushclient/notepad.txt", 0)

Lua example

SaveNotepad ("my_notepad", "c:/mushclient/notepad.txt", 0)

Lua notes

The ReplaceExisting flag is optional, and defaults to false.

Return value

1 = saved OK
0 = not saved

Related topic

Notepad

See also

FunctionDescription
ActivateNotepadActivates a notepad window
AppendToNotepadAppends text to a notepad window
CloseNotepadCloses a notepad window
GetNotepadLengthGets the length of the text in a notepad window
GetNotepadListGets the list of open notepads - returning their titles
GetNotepadTextGets the text from a notepad window
NotepadSaveMethodChanges the save method for this notepad window
ReplaceNotepadReplaces text in a notepad window
SendToNotepadCreates a notepad and sends text to it