Some time ago, someone asked how to change the Windows' registry with REBOL.
At that time I didn't know how to, but now I've found a way. This example
comes from Alexander Davidson's site http://members.tripod.com/~aadavids/ on
his excellent 'metapad' Notepad replacement. I recommend it highly. This is
the contents of %Filters.reg
REGEDIT4
; Custom file filters for metapad
; A.Davidson, 1999
;
; This is an example of how to customize the filter in metapad's Open and
; Save As dialogs. Make sure the syntax of the string below is absolutely
; correct (or else the behaviour is undefined). New drop down entries
; consist of two sub strings. The first is a description and the second
; is the actual filter. All substrings must be separated by the | symbol
; (which cannot be used in a description). The order here is the order they
; appear in the list. For example to have just one setting you would
; use the string: "FileFilter" = "Crap files|*.CRP;*.CRAP".
[HKEY_CURRENT_USER\Software\metapad]
"FileFilter" = "All File Types|*.txt;*.htm;*.html;*.c;*.cpp;*.h;*.java|Text
Files (*.txt)|*.txt|HTML (*.html; *.htm)|*.html;*.htm|Source Code (*.c;
*.cpp; *.h; *.java)|*.c;*.cpp;*.h;*.java|All Files (*.*)|*.*"
Simply create the above file using REBOL, then use the application interface
published earlier to execute the above file. If you can't remember it,
here's my version, based on it:
C++: {
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <dos.h>
int main() {
FILE *pF;
while (!0) {
if (pF = fopen ("Command.bat", "rt")) {
fclose (pF);
system ("Command.bat");
system ("erase Command.bat");
}
sleep (1);
}
return 0;
}
// End.
}
]
Command: func [String [string!]] [
write %"/C/C++/RblCmd/Command.bat" String
]
Notepad: function [File [file!]] [Alpha Drive] [
File: to-string File
replace/all File "/" "\"
Alpha: charset [#"A" - #"Z" #"a" - #"z"]
if parse File [thru "\" copy Drive Alpha thru "\" to end] [
replace File join "\" [Drive "\"] join {} [Drive ":" "\"]
]
Command join "Notepad.exe " File
]
Meta-thought for the day:
Make a program that's one source for both C++ and REBOL code...
Andrew Martin
[EMAIL PROTECTED]
http://members.xoom.com/AndrewMartin/
-><-