Create an embedded script file

  • Create a new NoteCase Pro document ("File" / "New").

  • Copy and paste some data branch from another one of your data documents into this branch

  • Create a new branch in the root called "Scripts". In fact it doesn't matter at all, where scripts are stored in the document, and what the title of the script branch or note is, but it is a good idea, to have some reasonable structure in the document.

  • Create a child note of "Scripts" called "Timestamp"

  • Paste the contents of the example script into that note. For pasting, don't use standard paste ("Edit" / "Paste" or Ctrl-V), but "Paste as text" ("Edit" / "Copy & Paste Special" / "Paste as Text" or Shift-Ctrl-V) , otherwise the script may be messed up in formatting, if you copy from within a browser window)

    Screenshot of a NoteCase Pro document with embedded timestamp script

  • Save the document with an arbitrary name in an arbitrary folder, e.g. in your new "Scripts" folder.
    (Hint: Whie your embedded scripts document is relatively small, you may want to choose the .ncz file format for saving (or .nce for encrypted storage). Compared to .ncd, it saves space. When your document grows much larger and load/save takes noticebable time, you may want to convert the file into .ncdb format (or .ncde for encrypted storage), which is optimized for access speed.)

  • Now select one of the data notes you pasted from the other document

    Screenshot of the embedded scripts document with selected data note

  • Then, choose "Scripts" / "Execute Note" from the menu. You are prompted to pick a document note.

  • Find the "Timestamp" note an click "OK"

    Screenshot of the "execute note" dialog

  • See the timestamp being appended to the current note.

    Screenshot of the timestamp being appended to the data note


Assign a keyboard shortcut

Now, you may want to make it easier to append a time stamp to your notes. Assign the script to a keyboard shortcut:

  • Use NoteCase Pro's menu "Scripts" / "Register Scripts" to open the script registration dialog

  • Click the "+" button to add a script

  • Choose the NoteCase Pro document, that contains the embedded Timestamp script, then select the Timestamp script

  • Close the dialog with the "X" button. Now your script is registered, appears directly in the Scripts menu and can be easily launched from there.

  • Open "Tools" / "Shortcut Settings"

  • Choose from the "Contect" dropdown the entry "Scripts and Plugins" to list the registered scripts and plugin

  • Select the entry for the Timestamp script

  • Then hit the desired shortcut, e.g. [Ctrl]-[.] (Ctrl and the dot)

  • Close the shortcuts dialog

Now you can easily append a timestamp to each current note by hitting [Ctrl]-[.]

 

Lua source syntax highlighting

NoteCase Pro supports syntax highlighting for a variety of programming languages, including Lua. This makes development of scripts inside NoteCase Pro much more convenient.

Here is how you can enable it:

  • Doubleclick the "Timestamp" script note. The "Note Properties" dialog is opened.

  • Write or select via dropdown "lua" in the "Source Language" field

    Screenshot of the source language setting in note properties dialog

  • Close the dialog by clicking "OK". Now the script note is displayed with syntax highlighting:

    Screenshot of the Timestamp script with syntax highlighting


  • You may now proceed with the Plugin Creation Tutorial, in order to learn, how you can easily generate a Plugin from your embedded scripts.