Personal Notes File


Command File

NOTEFILE comes with a default Command File (NOTEFILE.CMD) containing a sample code for commands to be executed by the Tools menu commands. This file must be present in the same directory as the NOTEFILE executable; otherwise it will not be executed. A practical way to disable Command File is to remove the NOTEFILE.CMD file from the NOTEFILE directory. Please note that, in Linux the name of the file should be fully in lowercase letters.

The provided sample NOTEFILE.CMD file is a batch file for Windows and a Bash shell script for Linux. The sample file is for illustration purposes and you can replace it with a script or a program written in other language, including C, Pascal, Go, Windows Script Host, PowerShell, Perl, Python, Ruby, Rexx, Node.js, PHP, or shells provided by Cygwin, as long as the name of the executable file remains the same and its functionality is as described below.

Functionality of the NOTEFILE.CMD executable

There are two cases when the NOTEFILE.CMD executable file is called from NOTEFILE:

  1. During program startup or later when the Reload Commands List command is selected, the NOTEFILE.CMD executable will be called with no parameter. In this case, it is expected that it will display lines in the format num string. Here, num should be an integer in the range 1 to 200 and string should be a non-blank command title that will be added as a menu item to the end of the Tools menu (only the first 50 characters of the string will be used). Only the first 25 lines matching the above-described format will be processed and the Tools menu will be populated with them; the rest will be ignored.
  2. When some command from the Tools menu is run, the NOTEFILE.CMD executable will be called with the corresponding parameter (the num value obtained in the above step). If the value of num is greater than 100, NOTEFILE will also prompt the user for additional parameters and these will be added as a second parameter to the executable call. For such a call to occur, a card from the current file should be selected and displayed in the Notes Information Area (see General Help On Personal Notes File.) During the call, any selected text from the card will be sent as input to the executable. After the execution of the call, any output created by the executable will be inserted at the insertion point or will replace the selected text.

Notes:

  • It is better to test your modified NOTEFILE.CMD file from command line, before trying to use it from NOTEFILE.
  • NOTEFILE will allow at most 4 seconds for the NOTEFILE.CMD executable to complete its execution during any call. If your executable runs longer, some output may be lost. Also, if your executable does not read data from input, you should not select any text in NOTEFILE before running the relevant command; because in such a case, NOTEFILE may hang due to the called NOTEFILE.CMD executable not processing any input. You will have to locate and kill the running NOTEFILE.CMD process or its child, so that NOTEFILE will resume.
  • Please, take care not to overwrite your customized NOTEFILE.CMD file by the sample version that comes in the .7z file of a new version of NOTEFILE during an upgrade process.