Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
calling variables
#1
Hi,

Could someone please tell me why the follwoing code won't work:

Code:
Copy      Help
str num
num="No#4*"

MSHTML.IHTMLElement el=htm("TD" "num" "" " Internet Explorer" 0 3 0x21 31536000)

str s1=el.innerText
s1.setclip

out s1

The code below does work fine, but I would like to do it the way in the first code (if that makes sense):

Code:
Copy      Help
MSHTML.IHTMLElement el=htm("TD" "No#4*" "" " Internet Explorer" 0 3 0x21 31536000)

str s1=el.innerText
s1.setclip

out s1

Thanks.
#2
Remove quotes from num.

MSHTML.IHTMLElement el=htm("TD" num ...

To use a variable in a dialog, enclose its name in parentheses, eg (num). Then QM will know that you want to use a variable, and will not add "". Parentheses are not needed for numeric values.
#3
Thanks Gintaras, I am a little closer to achieving what I want to do. Although I can't work out why the following code still won't work:

Code:
Copy      Help
str num1
num1="4*"

str num
num="No#"(num1)

out num
#4
Gintaras, I managed to do what I wanted with following code, but is it the correct way?

Code:
Copy      Help
str num1
num1="4*"
  
str num
num="No#"

num + num1

out num

Edit:

I think I may have found a bug, because the following code spits out an 8 digit number (always starting with "2"), depending on how you do it i.e. num + num1 or num+num1 etc.:

Code:
Copy      Help
str num1
num1="4"

str num
num="No#"

str num2
num2=num + num1

out num2

Just thought I'd let you know because it seems strange.
#5
In QM, s1=s2+s3 is not used to join strings. Instead, use s1.from(s2 s3). Read more in Help.


Forum Jump:


Users browsing this thread: 1 Guest(s)