Freemaster - ReadVariable don't fill vValue and tValue

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Freemaster - ReadVariable don't fill vValue and tValue

2,730 Views
softsmit
Contributor I
Hi,
im' trying to use FreeMaster to read a varible on my M523xEVB!
Freemaster run well and i can see the value of my variable on the WatchGrid.
So i write this Javascript to see it in the html command window:

Code:
<object name="pcm" width="0" height="0"classid="clsid:48A185F1-FFDB-11D3-80E3-00C04F176153"></object><script language="JavaScript">    var val,val2,error,a;  succ = pcm.ReadVariable("encoder_ssi",val,val2,error);  if(succ)  {   document.write(succ);    document.write(val);  }  else  {    document.write(succ);    document.write(error);  } </script>

 This code on the html control page return

succ = "true"
val    = "undefined"

Why can't i see the value of val if succ is true and i can read the variable on the watch-grid?

thanks at all! :smileywink:

Labels (1)
0 Kudos
6 Replies

723 Views
J2MEJediMaster
Specialist I
I don't see where succ is declared. Also, what does the Freemaster documentation say about WatchGrid's objects being available for use by the HTML's Document Object Model (DOM)?

---Tom

0 Kudos

723 Views
softsmit
Contributor I
"succ" isn't declared because in javascript it's not necessary...i think it's automatic.

The strange thing is that the "same" code, write whit VBscript run well!!!
but i want keep javascript like target language!

What does the Freemaster documentation say about WatchGrid's objects being available for use by the HTML's Document Object Model (DOM)? :smileysurprised: ????

0 Kudos

723 Views
J2MEJediMaster
Specialist I
Javascript is automatic in handling variable declarations, but it's preferable for the sake of code maintenance to declare var with your variables before you first use them. Or, let me ask this: why did you use var on the other variables and not on "succ"?

If the product supports communications with HTML documents, it's going to have to explain how the data is exported into such documents. HTML uses DOM to assemble the elements that make up the page. If the documentation does not state how to insert information into these elements, then I have to wonder if it's possible. Are there any examples provided in HTML that you can draw on? Or is it all VBScript?

Sorry for leading out with a jargon-heavy acronym there...

---Tom
0 Kudos

723 Views
softsmit
Contributor I
:smileysurprised: why did you use var on the other variables and not on "succ"?

Because the function ReadVariable can fill (i think) a variable space but can't create it...

Anyway the problem wasn't in the variable succ!!
The problem is that the code in VBscript runs well and in javascript the variables val and val2 aren't fill,
and the html browser show "undefine".
So does somebody use a javascript code in freemaster control page ad it runs well?
0 Kudos

723 Views
kurna
Contributor I

Hi.

 

Did you solve this problem? I am trying read variable from my aplication, VBS works good, I can read variables without problems, but when I use JavaScript, it do same thing like you - variable not fill...

Can you help me where is the problem

Thanks

0 Kudos

723 Views
lst_ali
Contributor I

I found a solution to this problem.  Seems like we need to reach into the ReadVariable function and take one of its local variables:

succ = pcm.ReadVariable("encoder_ssi");

val = pcm.LastVariable_vValue;

The value of encoder_ssi will be in val

0 Kudos