Javascript windows.external

Your error comes from:

**procedure** ViewerID;



Your call “window.external.GetHEScriptCom(‘UserMain.ViewerID’, ‘none’)” expects a function, and not a procedure. Replace your HEScript with:

**function** ViewerID: String;
Result := GetViewerSerial;

You may also look at GetManualHardwareID. For instance, see

Hi; I’m a new user and I’m having a problem using the getHEScriptCom function in Javascript.

Here is my Javascript code… (which should give me a unique ID of the runtime module)

var unitSerial = window.external.getHEScriptCom(‘GetViewerSerial’,’ ');
alert("unitSerial "+unitSerial);

I’ve tried a number of different arrangment of quotation marks but all I get back is an error saying “Wrong number of arguments or invalid property assignments”

Obviousely I’m doing something wrong… any help would be appreciated and provide some idea on how to work with ExeOutput functions…


New Information:

I figured out that I need to add an HEScript before I use this function – so I add the following code to UserMain

procedure ViewerID;



Then I used the Javascript code…

unitSerial = window.external.GetHEScriptCom(‘UserMain.ViewerID’, ‘none’);
alert("unitSerial "+unitSerial);

Now I get an error message
"Could not convert variant of typr(Null) into type (OleStr)"
and no alert box…

BTW: I tried to convert the return value to a string…
unitSerial = String(window.external.GetHEScriptCom(‘UserMain.ViewerID’, ‘none’));
but that didn’t help…

Therefore it looks like I’ve got a type mismatch – Does anyone know what I’m doing wrong?


Fantastic – that worked perfectly…
Thanks gdgsupport…

When you are in a new land – it’s difficult to notice one tree in a forest.
I never noticed any explanation about the differences between using functions and procedures.

To use this software I need to understand some advanced subjects…
For example I now need to figure out how to access and use the functions in a DLL :slight_smile:


No problem. DLL functions will be more complicate to import however.

Thanks gdgsupport…

You seem to be right again…

I can “touch” a DLL – but I can’t seem to pass variable information to it – or return any usefull information from the DLL.

Could you point me to any information that would help me out?

Basically, if you learn how to call DLL from Delphi, you can easily write imports of DLL in ExeOutput.

Our software accepts all calling conventions. You have to tell it which one to use thanks to the specific syntax.

    function functionName(arguments): resultType; 
    [callingConvention]; external "libName.dll" [name 'ExternalFunctionName'];

callingConvention: cdecl, stdcall…
resultType: Integer, string… and types supported by Delphi.
arguments: a list of function arguments.

It works like for Delphi-Pascal: see that can help you.


I finally discovered why I was having a problem passing a String value from ExeOutput to a custom DLL. I was thinking the ExeOutpur “String” type was passing a “value” – when in fact the “String” type is a “pointer” to the value. All I had to do was have my DLL “function” expect a (wide) pointer instead of a value.

I also discovered how to “return” a string from my DLL to a variable in my ExeOutput code using the “parameter passed by reference” strategy. In this way my DLL loads the return string directly into the same “pointer” used to “get” the string (which I can collect after my call to the DLL).


Thank you for the feedback.