Taking value from javascript to hescript (SOLVED)

Hi,

Can I take a javascript variable value to hescript. Is this possible.

Basically, I want to generate a random number in javascript and then want to transfer its value to registry. For writing to registry I am using hescript function WriteRegStr, so i want to use the value in writeregstr function.

Please give a working example.

See http://www.htmlexe.com/help/windowexternal.htm

Use
var Value = myfunctiontogeneraterandomnumber();
window.external.SetGlobalVariable(‘myvar’, Value, false);

The variable is now correctly setup.

But when I use the following hescript

procedure bms4;
var
S3: String;
begin
S3 := GetGlobalVar(rnumber1,“7777”, True);
WriteRegStr(4,“SOFTWARE\BMS79”,“SAN5”,S3);
end;

it gives me error as unknown identifier ‘rnumber1’

whereas this is the name of global variable, I setup in javascript in my webpage

var rnumber=Math.floor(Math.random()*100000000)
window.external.SetGlobalVariable(“rnumber1”, rnumber, false);

Please advise, what is the error in hescript.

You have made a fault, it should be:

procedure bms4;
var
S3: String;
begin
S3 := GetGlobalVar(“rnumber1”,“7777”, True);
WriteRegStr(4,“SOFTWARE\BMS79”,“SAN5”,S3);
end;

Thanks for the help.

One point to note, if I use True, it is not working, I have removed it and now its working perfectly.

This topic was automatically closed after 24 hours. New replies are no longer allowed.