DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Using Variable from Dialog box to input offset?

I want to use a variable generated from a dialog box to be used to generate an offset. Am I able to use variables in that calculation?

 

The script I'm trying to use is

 

Dim MyInput
MyInput = InputBox("Enter Fixture Grove Depth In Inches","DIAdem","")
Call MsgBox("You entered: " & MyInput)

 

'Add Fixture Height Offset of 0.115 inches
Set ChnResult = ChnOffset("[2]/Absolute Encoder 1", "/Absolute Encoder 1", MyInput, "free offset")
Set ChnResult = ChnOffset("[2]/Absolute Encoder 2", "/Absolute Encoder 2", MyInput, "free offset")
Set ChnResult = ChnOffset("[2]/Absolute Encoder 3", "/Absolute Encoder 3", MyInput, "free offset")

 

When I use a number, rather than the variable "MyInput" it works. I'm new at all this, is there anything additional I need to use that variable?

 

Thanks

0 Kudos
Message 1 of 2
(2,033 Views)

MyInput is a string.

 

Dim MyInput
MyInput = InputBox("Enter Fixture Grove Depth In Inches","DIAdem","")
MyInput = CDbl(MyInput)
Call MsgBox("You entered: " & MyInput)

Adding a string number conversion will work. Be aware that the CDbl is depending on local setting according to decimal point. 

0 Kudos
Message 2 of 2
(2,001 Views)