Setting and retrieving global variables (SOLVED)

Hi, got a problem and I just am not sure what I am doing wrong. It is to do with using hescript to set and get a global variable under Chromium web kit.

Basically got two toolbar buttons - one which calls Macros.StartSimulation and the other calls Macros.StopSimulation via Execute this script function

However in a script for an html5 simulation I have a javascript loop which contains the line

var srun = exeoutput.GetGlobalVariable(“simrun”);

but when I log srun to console it shows up as undefined, even when any toolbar button is selected/pressed. I would have hoped srun would go to either 1 or 0 other than constantly showing undefined. No idea what I am doing wrong.

The hescripts are coded as follows…

procedure StartSimulation;
begin
SetGlobalVar(“simrun”,“1”,false);
end;

procedure StopSimulation;
begin
SetGlobalVar(“simrun”,“0”,false);
end;

all under macros.

Hope to hear back.

No worries, solved it myself… It was as simple as replacing var srun = exeoutput.GetGlobalVariable(“simrun”); with var srun = exeoutput.GetGlobalVariable(“simrun”,“0”); Missed the 2nd argument. Working now.