Just a small code snippet (vb6) if anyone wants it - its for a small app that reads command line parameters and send them to the dmx server. it takes parameters in the form
dmxauto.exe m=0 c=0 v=0
with m being the mode, c being the channel and v being the value - note: no error checking has been added!
you can group the values, as long as you have a mode set first eg
dmxauto.exe m=2 c=1 v=64 c=2 v=64 c=12 v=0 c=31 v=255
it is read from left to right
I use it just now for batch files and scheduled tasks for the lights that havn't got round to automating, but will also be useful to enable dmx from any other language, and also from any other programs that allow launching external programs.
create a form, add a winsock control called 'winsock' and a timer called 'timer'. I have a logo on my form - it pops up in the top corner for 1.5 seconds then dissapears.
Code:
Dim Args() As String
Dim ArgString As String
Dim Mode As Integer
Dim ModeSet As Boolean
Dim Channel As Integer
Dim ChannelSet As Boolean
Dim Value As Integer
Dim ValueSet As Boolean
Private Sub Form_Load()
Me.Top = 0
Me.Left = 0
Me.Show
Winsock.Close
Winsock.Connect
End Sub
Private Sub Timer_Timer()
Timer.Enabled = False
Winsock.Close
End
End Sub
Private Sub Winsock_Connect()
ArgString = UCase(Command)
If InStr(1, ArgString, " ") Then
Args() = Split(ArgString, " ", , vbTextCompare)
Else
End
End If
For x = 0 To UBound(Args)
Select Case Left(Args(x), 2)
Case "M="
Mode = Val(Mid(Args(x), 3))
ModeSet = True
Debug.Print "M=" & Val(Mid(Args(x), 3))
Case "C="
Channel = Val(Mid(Args(x), 3))
ChannelSet = True
Debug.Print "C=" & Val(Mid(Args(x), 3))
Case "V="
Value = Val(Mid(Args(x), 3))
ValueSet = True
Debug.Print "V=" & Val(Mid(Args(x), 3))
Debug.Print "sending:" & Mode & " " & Channel & " " & Value
Winsock.SendData Chr$(Mode) & Chr$(Channel) & Chr$(Value)
End Select
Next x
Timer.Enabled = True
End Sub