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

Offline alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2181
  • Karma: +37/-3
    • View Profile
    • HippoEDIT
Macro-Script Converter
« on: February 29, 2012, 09:56:26 pm »
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.
« Last Edit: February 29, 2012, 09:58:06 pm by alex »

 

Related Topics

  Subject / Started by Replies Last post
39 Replies
15939 Views
Last post April 22, 2010, 06:40:49 pm
by alex
1 Replies
2653 Views
Last post September 27, 2009, 07:47:24 pm
by Stefan
1 Replies
1619 Views
Last post October 25, 2009, 11:05:59 pm
by alex
4 Replies
1861 Views
Last post February 18, 2013, 05:28:15 pm
by Alain
1 Replies
1655 Views
Last post December 31, 2014, 05:58:27 pm
by alex