Machsupport Forum

Mach Discussion => VB and the development of wizards => Topic started by: Fiero Addiction on December 10, 2010, 07:10:01 PM

Title: need help with simple script
Post by: Fiero Addiction on December 10, 2010, 07:10:01 PM
I currently use this one line in a macro file to toggle the THC on/off.

 DoOEMButton(123)  ' toggle THC on/off

This works perfectly. The problem I have is that the program does not know the current state of the THC. So I am trying to make separate THC on and off macros.

' to turn THC on
Cur_THC_status = GetOemLed(24)           'get the state of the THC
  If Cur_THC_status  = 0 Then                ' if the THC is off
   DoOEMButton(123)                              'push the THC button to toggle it on
  End If                                        'end condition statement

' to turn THC off
Cur_THC_status = GetOemLed(24)           'get the state of the THC
  If Cur_THC_status  = 1 Then                ' if the THC is on
   DoOEMButton(123)                             ' push the THC button to toggle it off
  End If                                        'end condition statement

These do not work and I don't know why. I know very little about scripting. Suggestions would be appreciated.
Title: Re: need help with simple script
Post by: Ya-Nvr-No on December 10, 2010, 09:11:15 PM
' to turn THC on
' get the state of the THC
  If GetOemLed(24)  = false Then                ' if the THC is off
   DoOEMButton(123)                              'push the THC button to toggle it on
  End If                                        'end condition statement

' to turn THC off
' get the state of the THC
  If GetOemLed(24)  = true Then                ' if the THC is on
   DoOEMButton(123)                             ' push the THC button to toggle it off
  End If                                        'end condition statement

Title: Re: need help with simple script
Post by: Fiero Addiction on December 11, 2010, 11:28:54 AM
Works great, thank you.