Author
Topic: Macro-Script Converter (Read 2290 times)

During design of macro recording in HippoEDIT it was rather hard to select format for storing of the macro steps between sessions. It was very tempting to merge the macro serialization language and scripting, but after some thoughts and checks I have end up in xml serialization.

Why I did so: - when selecting of the scripting language for serialization which to take? HippoEDIT supports several languages: JavaScript, VB Script (by default), PHP, Perl, ActionScript (with additional engines for Active Scripting). Shell I did a special setting to select language for storing or ask every time? If I can serialize to known languages, but what to do if would be installed not known scripting language: syntax for every language different?- where to serialize between session, should be stored in workspace, ideally, but than script should be escaped to be stored as XML CDATA etc.- if script would be modified, how to handle special macro play features (till document end, stop if search fails). It is rather complex to handle for ordinary script.

So, because of mentioned problems, I have decided to use xml format for storing of macros. XML serialization is "native" for HippoEDIT, fit good for workspace saving, and XML serialization format does not allow so big flexibility, which can be achieved with scripting, so HE can control macro execution better.

But still I want to have the way to get a script from a macro And this was solved by special Macro Converting script. It can be written in any scripting language, supported by HE (Active Scripting) and does translating of stored macro steps into desired scripting language. So, this make it possible to extend HE with converters in any scripting language, the code is open and can be modified, and feature can be added only if you need it, by installing script-plugin.

Disadvantages:Macro converted to a script, could not be converted back. There are some limitations during conversion from macro to script.

The Macro to JavaScript converter attached toe the post. To install it, just place file some where and call it from Tool->Execute... If succeeded, you will see Convert to JavaScript... under Macro menu.Uninstall as other script plugin, Tools->Options->Plugins and uncheck converter scritpt.