Scratch Pad

 

A Note Taking Utility



with a Libronix ToolBar

 

 

 Download Installer         

Get the older Rich Text version here.

Description

Scratch Pad is a very simple Cut and Paste editor that provides an easy method for users to take notes in a multi window environment like Libronix. Users can type text into the editor window, drag and drop text from other windows and also perform regular cut, copy and paste actions. Content is saved in regular HTML files.

Scratch Pad is automated. That means that users can write Libronix button scripts (or other application scripts) to send whatever content they want to the window or copy content from the window (e.g. one could write a script to paste the text of the active bible reference into the Scratch Pad window). The distribution includes a Libronix toolbar with five buttons. Each of these buttons performs a simple scratch pad task described below.

The Scratch Pad  window is system modal. This means that it will always remain on top and in view regardless of which application is currently active. It is also resizable and collapsible. When collapsed it reduces to only the title bar. That keeps the window in view but out of the way when doing other work. Any scripting actions that affect the contents of the window will continue to work when the window is in a collapsed state. Closing the window while in a collapsed state (by clicking on the window's "X" box ) will cause a prompt asking the user to save changes. This is the same action as when the "Close" button is clicked when the window is in a not collapsed state. The windows size, position and collapsed state are  remembered by the program and  restored the next time the application is started.

Except for standard keyboard input (and drag and drop) all I/O operations are performed through clipboard operations. This facilitates  the preservation of fonts, colors and so on when adding content to (or taking content from) the editor window.

 

Installation

Simply download the installation exe (Scratch Pad Setup.exe) and save it to your desktop. Start it up and navigate through the installation wizard. Scratch Pad will be installed and registered. The Scratch Pad toolbar will be copied to your Libronix CustomToolbars folder. The toolbar will show up in Libronix the next time you start it up or reload your workspace.

Note: The Scratch Pad exe will be installed in "Program Files\Builder Builder" and the program group for your Start Menu will be "Libronix PBB Builder". This will be the case regardless of whether you've installed Builder Builder on your system or not. Without going into a whole lot of detail, this application is designed to interact with Builder Builder (future upgrade) and preserving the folder convention makes it easier to accommodate those who want Builder Builder but don't have the .Net framework installed on their system. In short, it saves copying a whole lot of redundant MS DLLs all over people's hard drives.

 

The Application

 

The application can be started up in the usual way or through a COM directive (e.g. ActiveXObject) in a script or in another program. The application window is a simple dialog with six buttons and a right-click context menu. The user can collapse the window by double clicking on the Title bar. Double clicking a second time will expand it to it's former size.

 

The Buttons

 

The buttons should all be easily recognizable by all and shouldn't need any explanation but, for completeness sake, I'll describe them anyway in the following table.

Cut    Ctrl+X

Remove the currently selected text.

Copy    Ctrl+C

Copy the current selection to the clipboard.

Paste    Ctrl+V

Replace the current selection with the clipboard content

Open File    Ctrl+O

Open an file and load the contents into the Scratch Pad window.

The original version of Scratch Pad saved content in Rich Text (.rtf) files. This version saves them in HTML files. The open command will, however, open both HTML files and MS Word files (.rtf, .doc).

Save File    Ctrl+S

Save the contents of the Scratch Pad window to an HTML file on disk.

Open/Paste Into Builder Builder  SPPasteToBB  

This button will open an instance of Builder Builder if one is not already open. If Builder Builder is open then it will paste the selected text into the Builder Builder main editor window. If there is no selected text then a dialog will appear asking the user if the entire contents of the Scratch Pad window should be pasted into Builder Builder. If the response is negative then it won't do anything at all.

The "Paste into Builder Builder" button is only applicable if "Builder Builder" is installed on the users system. It does not appear by default. It can be made to appear by using the scripting method "ShowBBButton" or by opening the application with the command line switch "/BB". It will not appear in any instance if "Builder Builder" is not installed on the users system.

Important: The Builder Builder / Scratch Pad interaction will not work properly unless the proper versions of both applications are installed. Both must have a version number of 3.0 or greater. To see the version number of Builder Builder execute the command "Help—>About Builder Builder". Prior to the November 14 / 2006 compile this dialog didn't contain any version number (I've been a little lax in that area) so if you see one you're ok To view the version number in Scratch Pad right click on the title bar and invoke "About Scratch Pad" or hit F1 to bring up the about dialog.

Close  

Exit the ScratchPad application.

Note: If the Scratch Pad is connected to Builder Builder then the "Close" button will not shut down the application. Rather it will make the window invisible until the next time it is made visible by script or by the "Scratch Pad" button on the Builder Builder Utility Toolbar. To quit the application while connected to Builder Builder use the context menu "Quit" command instead.

If Scratch Pad is open when Builder Builder is closed then the user is prompted with a query asking if Scratch Pad should be closed. If the user answers "No" and Scratch Pad is in a non visible state then it will be made visible before Builder Builder exits.

 

The Context Menu

The context menu contains all of the button commands as well as a few others. The extra commands are listed in the following table.

 

 Undo  Ctrl+U

 Undo the previous action.

 Redo  Ctrl+R

 Redo the action that was previously undone.

 Find  Ctrl+F

Open a Web Browser Find dialog.

 Clear  Alt+X

 Remove all of the Scratch Pad window contents

  Cut   Ctrl+X

 Cut the selected text

 Copy  Ctrl+C

Copy the Selected text to the Clipboard.

 Copy All  Ctrl+L

 Copy all of the window contents to the clipboard

 Paste  Ctrl+V

Paste clipboard content into the current selection.

Paste RTF  Ctrl+W

Paste clipboard content into the current selection in RTF format.

The first version of this application used a Rich Edit control in the main window. It was changed to an HTML edit control because of problems copying footnotes and citations. However the RTF format did have some advantages, especially when it came to preserving colors and fonts. This command is included to preserve the paste as RTF capability.

 Paste Plain Text  Ctrl+Q

Paste the contents of the clipboard into the current window selection as plain text.

 Select All  Ctrl+A

 Selects all of the contents of the Scratch Pad window.

 Open  Ctrl+O

Open a file from disk and load the contents into the Scratch Pad window.

 Save  Ctrl+S

Save the contents of the Scratch Pad window in an HTML file on disk.

 Quit  

Exit the application. This is the same as the action of the "Close" button

 Set Default Font  Ctrl+F

Allows the user to select the default font for the Scratch Pad application. This is done with a standard fonts dialog.

Note: The default font only applies to plain text paste actions. It will not have any effect on keyboard input.

 

The scripting object

In javascript the application can be opened with the "ActiveXObject" function and a handle to an object of a running instance can be obtained with the "GetObject" function.

e.g.

      var objSP = new ActiveXObject("BBscratchpad.Application");

or

    var objSP = GetObject("", "BBscratchpad.Application");

The interface is quite simple. There are fifteen methods and one property provided. They are described in the following table:

Methods

     Parameters    
ShowBBButton BOOL pShow

Cause the "Open/Paste into Builder Builder" button to appear or disappear.

Undo   None

Undo the last edit action

Redo  None

Redo the last action that was undone.

Cut  None

Cut the current selection from the window.

ClearAll  None

Remove all content from the Scratch pad window

Copy  None 

Copy the current selection to the clipboard

Copy All None

 Copy all of the window contents to the clipboard

 Paste None

 Replace the current selection with the clipboard content

PasteRtf None

Paste the contents of the clipboard into the current window selection as RTF format.

PastePlainText None

Paste the contents of the clipboard into the current window selection as plain text.

 OpenFile  None

Opens an open file dialog. Loads a file from disk into the Scratch Pad edit window.

 Save  None

Opens a save file dialog. Save the contents of the Scratch Pad window to an HTML file on disk.

 SaveToFile  String pPath

Saves the contents of the Scratch Pad window to the destination described by the pPath parameter.

e.g.

SaveToFile("C:/MySpFiles/thisfile.htm");

LoadSaved None

Load the most recent saved file into the Scratch Pad window

 Close None

Close the application.

CloseForce   None

 Shuts down the application without a "Save Content" prompt if changes have been made to the scratchpad window.

Properties

Visible

Hide or show the Scratch Pad window.

e.g.

objSP.Visible = false; // keeps the application open but hides the 
                                      //window.

objSp.Visible = false; // Shows the application window.

 

The ToolBar

 

The Libronix toolbar that is installed with this application has five buttons that perform simple Scratch Pad functions. The buttons are described in the following table.

 Open Scratch Pad  

This button will open Scratch Pad. If Scratch Pad is already open but hidden it will make the window visible. If the application is open and visible this button won't do anything.

Open and Load Last Saved  

This button will open Scratch Pad and load the last saved file into the window. If Scratch Pad is already open but hidden it will make the window visible. If the application is open and visible this button won't do anything.

Note: Just keep the Open button that you prefer and delete the other one. If at some point in the future you decide you want to change the "Open" button to "Load" (or "Not Load" depending on which one you kept) then just edit the button script and change the value of the "loadSaved" bool at the top.

For example, if you kept the "Open and Load Last Saved" button and  you later prefer that this button 'does not' load the last saved file into the editor window then edit the script, remove the double slashes from the beginning of the line:

//var loadSaved = false;

and comment out the line (add double slashes to the beginning of):

var loadSaved = true;

 Paste Selected  

This button will paste the selected text in the active Libronix resource window into the Scratch Pad window. If the Scratch Pad window has text selected then the pasted text will replace the selected text.

Paste selected RTF  

This button does the same thing as the "Paste Selected" button except that the resource selected  text will pasted as in a format that will mimic the RTF style of the old control.

 Paste Selected Plain Text   

This button does the same thing as the "Paste Selected" button except that the resource selected  text will pasted as "Plain Text".

 

This program was designed and implemented by John McComb

 

back       Go Back