Description of Replacer utility |
Problem: Some editors, for example Microsoft
FrontPage Editor 3.0, manages to format a scripts-source code, and
occasionally in an outcome, the code ceases correctly to be executed (for
example, code known Counter http://SpyLOG.com) :-(... However, other of it a
possibility (I have in mind FrontPage Editor) like me personally, and I do not
have desire to refuse it only for this reason.
Solution: I have not become hardly to understand: how
it is necessary to correct Java-script code to remove a marked above mistake,
and simply has written the utility, offered to your attention, which makes
replacement of all insertions of script-code in html-files of the specified
catalogue (and in all subdirectories) by a code from the specified script-files.
Besides, it seemed, that the similar utility can be useful, not only to
overcoming a marked problem...
In order to the script-code was identically recognized in html-files, it should be made in unique for it by using a beginning/ending markers of a code. Accordingly same markers, should be located and in a code of appropriate script-files. In order to not make a fuss, easy way to locate in such markers a names of Script-files containing a script-code. For example:
File MainPageCounter.js:
<!-- MainPageCounter.js begin -->
<!-- SpyLOG v.... -->
.... here purely script-code
<!-- SpyLOG -->
<!-- MainPageCounter.js end -->
Here bold font chosen markers accordingly beginnings and endings of a
script-code. Also pay attention, that:
In other words, the first line of the script-file containing a symbol '<' in the first position is interpreted as a line containing of a beginning marker, and the last line with a symbol '<' in the first position - ending marker. I hope, for scripts it not so force restrictions :-)
Initially, I was not going to create any user interface for editing of set-up parameters of this utility, however has thought, that in our changed world it will not superfluous :-) therefore by using means MFC VC ++ 6.0 I have made all this. For want of it, I used controls, delivered with VS 6.0+SP4, and if at you it not so, again, you can take advantage of a source code on MS VC++ 6.0 to adjust it that you have...
So, all set-up properties has placed in one window of properties on two it's tabs: Source and Scriprs. On a tab Source - the folder (Folder) and extensions (Extensions) of files are defined, in which it is required to make substitution from a script-code, and also it is possible to check on/off mode of search of such files in all includes subfolders (Include subfolders).
On the tab Scriprs, you can edit the list of your script-files, which code will be inserted substituting "the spoiled code" in source files, indicated on the tab Source
i.e. here you can:
So, it is all set-up..., it is necessary also to tell, that all current information to be stored in the system register, the key to which I hope is seen on the following Figure:
... and again, if you it does not arrange, - change appropriate VC++ a code... :-)
At last, by choice menu item Options\Update (and if nothing will happen unforeseen), you receive the protocol of the made modifications:
Information here is mapped as follows:
Before download source code, attentively read Final notes please... Download [119KB]