How to pass Java Script variable to MTW native language

Share your macros, knowledge, solutions, services, ...
Post Reply
Petr
Posts: 106
Joined: Tue Oct 18, 2016 1:12 pm

How to pass Java Script variable to MTW native language

Post by Petr » Thu Nov 17, 2016 8:26 pm

Q: How to pass Java Script variable to MTW native language?

A: It is possible to exchange Java Script variables and the native macro language variables through registry.

This is a macro that contains JavaScript that puts a text to registry:

Code: Select all

<cmds>
<script_js>
var wsh = new ActiveXObject("WScript.Shell");
var key = "HKCU\\Software\\Pitrinec\\jsVariable1";
var jsVariable1="This is Value1";
wsh.RegWrite (key, jsVariable1, "REG_SZ");
</script_js>
And this is the macro text that reads the text from registry to a variable:

Code: Select all

<cmds>
<reg_getvalue>("HKEY_CURRENT_USER\Software\Pitrinec","jsVariable1","vJsv1")
<msg>(-100,-100,"%vJsv1%","",1,0,0,0)

Post Reply