Hello Guest it is August 20, 2019, 05:33:25 PM

Author Topic: Is this a valid line of VB script?  (Read 2289 times)

0 Members and 1 Guest are viewing this topic.

Is this a valid line of VB script?
« on: December 18, 2009, 07:20:30 PM »
I'm troubleshooting an OEM macro (that seems to work in version .029 but not in version .032) with little VB knowledge. It contains a line that I can't figure out:

"wait = GetOEMLED(11) = 0"

Is this line with two "=" symbols valid and if so can someone tell me what it is trying to do?

Thanks - Terry

Offline zealous

*
  •  492 492
  • HI!
    • View Profile
    • Artsoft Solutions
Re: Is this a valid line of VB script?
« Reply #1 on: December 19, 2009, 12:40:36 AM »
In VB "=" means this equals that

Code: [Select]
wait = 4
msgbox wait 'returns 4

or

Code: [Select]
this = true
that = true

if this = that then
msgbox "they are the same"
End If

You would have to provide more of the code to figure out what is meant to happen.

Spindle ON LED (CW or CCW) = GetOemLED(11)

Are you checking to see if the spindle is on and how long to wait for?

Code: [Select]
Wait = 1000
If GetOEMLED(11) = True Then
Sleep(wait)
End IF
Re: Is this a valid line of VB script?
« Reply #2 on: December 19, 2009, 04:26:41 AM »
I'm still confused though about what the two equal signs on the same line are trying to do. It seems that a variable 'wait' is being assigned the boolean result of Get OEMLed(11), but what is the "=0" at the end doing? - Terry

Offline Hood

*
  •  25,849 25,849
  • Carnoustie, Scotland
    • View Profile
Re: Is this a valid line of VB script?
« Reply #3 on: December 19, 2009, 04:37:29 AM »
looks to me that its saying to wait if OEMLED 11  is equal to zero, ie off.

Hood
Re: Is this a valid line of VB script?
« Reply #4 on: December 19, 2009, 03:22:00 PM »
I'm troubleshooting an OEM macro (that seems to work in version .029 but not in version .032) with little VB knowledge. It contains a line that I can't figure out:

"wait = GetOEMLED(11) = 0"

Is this line with two "=" symbols valid and if so can someone tell me what it is trying to do?

Thanks - Terry

It would be better written:  "wait = (GetOEMLED(11) = 0)".  It is valid, but perhaps poor coding practice.  GetOEMLED(11) = 0 will be evaluated as a boolean expression, returning TRUE if OEM LED 11 is Off (0).  So, wait will be set to TRUE (non-zero) if LED 11 is Off, and FALSE (zero) if LED 11 is on.

Regards,
Ray L.
Regards,
Ray L.