SaveNotepad
Script function

world.SaveNotepad

DOC_scripting Read about scripting

Type

Method

Summary

Saves a notepad window to disk

Prototype

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

DOC_data_types View list of 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




See Also ...

Topic

DOC_notepad Notepad

Functions

FNC_ActivateNotepad ActivateNotepad (Activates a notepad window)
FNC_AppendToNotepad AppendToNotepad (Appends text to a notepad window)
FNC_CloseNotepad CloseNotepad (Closes a notepad window)
FNC_GetNotepadLength GetNotepadLength (Gets the length of the text in a notepad window)
FNC_GetNotepadList GetNotepadList (Gets the list of open notepads - returning their titles)
FNC_GetNotepadText GetNotepadText (Gets the text from a notepad window)
FNC_MoveNotepadWindow MoveNotepadWindow (Move and resize the specified notepad window)
FNC_NotepadColour NotepadColour (Changes the text and background colour of the selected notepad window)
FNC_NotepadFont NotepadFont (Changes the font and style of the selected notepad window)
FNC_NotepadReadOnly NotepadReadOnly (Make a selected notepad window read-only)
FNC_NotepadSaveMethod NotepadSaveMethod (Changes the save method for this notepad window)
FNC_ReplaceNotepad ReplaceNotepad (Replaces text in a notepad window)
FNC_SendToNotepad SendToNotepad (Creates a notepad and sends text to it)

(Help topic: function=SaveNotepad)

DOC_contents Documentation contents page