The Scrit Plugin is a plugin for DrRacket that is similar to GEdit’s External Tool plugin.
Its purpose is to make it easy to extend DrRacket with small scripts that can be used in the definition window, on the selected text.
Click on Scripts/New Script, and enter Reverse. This creates and opens the .rkt and .rktd files. Also, a new entry automatically appears in the Scripts menu.
(define (transform-input-string str) (list->string (reverse (string->list str))))
Then go to a new tab, type some text, select it, and click on Scripts/Reverse.
This DrRacket plugin adds a Script menu to the main window. This menu has several items, followed by the (initially empty) list of active scripts.
a .rkt file, the script itself (with a sample program)
a .rktd file, the metadata of the script with the default values
The script menu is rebuild each time the user activates it, so that changes are taken into account as soon as possible.
The default location of the scripts is in a subfolder of (find-system-path ’home-path). The directory of the user scripts can be change through DrRacket’s preferences (in Edit/Preferences/Scripts).
This is the script file. It must provide the transform-input-string (that’s not a very good name) function, as in the sample code. It is meant to be executable by itself, to ease the testing process.
This is the metadata file. It contains an assocation list that defines the configuration of the script.
sub-menu : string?
A string for the label of the sub-menu in which the script will appear.
output-to : (one-of 'selection 'new-tab 'message-box)
If 'selection, the output of the transform function replaces the selection in the current tab (or insert at the cursor if there is no selection). If 'new-tab, a new tab is created and the output of the scritp is written to it. If 'message-box, the output is displayed in a message-box.