VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Begin VB.Form mainform 
   Caption         =   "Form1"
   ClientHeight    =   420
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   2595
   Icon            =   "Form1.frx":0000
   LinkMode        =   1  'Source
   LinkTopic       =   "bs"
   ScaleHeight     =   420
   ScaleWidth      =   2595
   StartUpPosition =   3  'Windows Default
   Visible         =   0   'False
   Begin MSComDlg.CommonDialog CommonDialog1 
      Left            =   7080
      Top             =   3360
      _ExtentX        =   847
      _ExtentY        =   847
      _Version        =   393216
   End
   Begin VB.TextBox Text1 
      Height          =   615
      Left            =   4080
      MultiLine       =   -1  'True
      TabIndex        =   1
      Text            =   "Form1.frx":0442
      Top             =   7560
      Width           =   6135
   End
   Begin VB.CommandButton Command1 
      Caption         =   "KILL"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   18
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   3600
      TabIndex        =   0
      Top             =   8880
      Width           =   6135
   End
   Begin VB.Label Label1 
      Caption         =   "Why the hell can you see this?..."
      Height          =   855
      Left            =   120
      TabIndex        =   2
      Top             =   120
      Width           =   3375
   End
End
Attribute VB_Name = "mainform"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'Public Sub gto(all_arg$)
'
'srch$ = "LABEL " + UCase$(all_arg$)
'For d = 1 To mx
'    If LTrim$(UCase$(script$(d))) = srch$ Then pointer = d
'Next
'
'End Sub

Private Sub Command1_Click()
    End
End Sub

' otherwise this will stay up
Public Sub Form_Activate()
    
    
'Unload Me
mainform.Hide

End Sub

Private Sub Form_LinkExecute(CmdStr As String, Cancel As Integer)
tttt$ = "* got dde command " + CmdStr + " *"

End Sub

Public Sub Form_Load()
'Imports System.Math
ReDim inductarray$(0, 0, 0)
ap_x = 0
ap_y = 0
ap_z = 0
max_array_x = 0
max_array_y = 0
max_array_z = 0

On Error GoTo erhandle
GoTo skip
erhandle:
showdbug
dbug " ", "runtime"
dbug "Error report:", "runtime"
dbug (Error), "runtime"
dbug " ", "runtime"
dbug "Variable dump", "runtime"
dumpvar

'MsgBox ("Script Ended Badly")
Do
DoEvents
Loop
End
skip:

Dim classTab As Long
Dim windowTab As Long
Dim SelectedHandle As Long
Dim SelectedClass As String
Dim SelectedTitle  As String
    Dim hwnds() As Long
    Dim rlim As Long
  Dim X_tit As Integer
  Dim CurTime As String * 35
  Dim CapText As String * 35
  Dim NewCap As String * 35
  Dim CapLength As Integer
  Dim L_tit As Integer

cd$ = CurDir$
Form1.Hide
MX_VAR = 1
'mainform.Show
'mainform.Hide

    BuzzWindowHandle Val(Trim$(Command$))
    tempHandle1 = FindWindowEx(WindowHandle, 0, "MDIClient", "")    'sub window1
    tempHandle2 = FindWindowEx(tempHandle1, 0, vbNullString, "Pattern Editor")  'pattern editor window
    
    PatternEditorWindow = FindWindowEx(tempHandle2, 0, "AfxFrameOrView42s", "") 'pattern's frame
    PatternWindowHandle = FindWindowEx(tempHandle2, 0, "AfxFrameOrView42s", "") 'pattern's frame
    setstring "pattern", Str$(PatternWindowHandle)
        
    SequencerEditorWindow = FindWindowEx(tempHandle1, 0, vbNullString, "Sequence Editor")  'seq editor window
    WavTabWindow = FindWindowEx(tempHandle1, 0, vbNullString, "Wavetable")  'seq editor window
    setstring "wavtab", Str$(WavTabWindow)
    
    PatternEditorToolBar = FindWindowEx(WindowHandle, 0, "#32770", "")
    PatternEditorPatternName = FindWindowEx(PatternEditorToolBar, 0, "ComboBox", "")
    PatternEditorMachineName = FindWindowEx(PatternEditorToolBar, PatternEditorPatternName, "ComboBox", "")
    PatternEditorWaveName = FindWindowEx(PatternEditorToolBar, PatternEditorMachineName, "ComboBox", "")
    PatternEditorBaseOctave = FindWindowEx(PatternEditorToolBar, PatternEditorWaveName, "ComboBox", "")
    
    MasterWindowHandle = FindWindowEx(WindowHandle, 0, "AfxControlBar42s", "Master")
    Master2WindowHandle = FindWindowEx(MasterWindowHandle, 0, "#32770", "Master")
    BPMHandle = FindWindowEx(Master2WindowHandle, 0, "Edit", vbNullString)
    TPBHandle = FindWindowEx(Master2WindowHandle, BPMHandle, "Edit", vbNullString)
    
    batch$ = Trim$(Right$(Trim$(Command$), Len(Trim$(Command$)) - InStr(1, Trim$(Command$), " ", vbBinaryCompare)))
    t$ = "running batch " + batch$
    btch$ = batch$
    dbug t$, "runtime"

If Left$(batch$, 1) = Chr$(34) Then batch$ = Right$(batch$, Len(batch$) - 1)
If Right$(batch$, 1) = Chr$(34) Then batch$ = Left$(batch$, Len(batch$) - 1)

If Left$(batch$, 1) = "+" Then batch$ = Right$(batch$, Len(batch$) - 1)
If Right$(batch$, 1) = "+" Then batch$ = Left$(batch$, Len(batch$) - 1)

If batch$ = "" Then
'MsgBox ("No Script specified")

showdbug
showdebug = 1

End If
'set system variables------------------
dbug "buzz5cr1pt debug console", "runtime"
dbug " ", "runtime"
dbug "http://www.buzzformat.com/buzzscript/", "runtime"
dbug "", "runtime"
dbug "", "runtime"
dbug "", "runtime"
setstring "buzzhandle", Trim(Str$(WindowHandle))
setstring "SCRIPT", batch$
setstring "VERSION", "Buzzscript 2.0 pre-alpha 1 - Buzzformat.com test release (engine version 2.001) "
dbug variable("VERSION"), "runtime"
dbug variable("SCRIPT"), "runtime"

'ensure inductavars exists-------------
    If (Dir$(cd$ & "\inductavars.txt") = "") Then
        Dim intFileEnsurer As Integer
        intFileEnsurer = FreeFile
        Open cd$ & "\inductavars.txt" For Append Lock Write As #intFileEnsurer
        Close #intFileEnsurer
    End If

'read in inductavars-------------------
 poop$ = cd$ + "\inductavars.txt"
Open poop$ For Input As 3
dbug "inductavars init", "runtime"
While Not EOF(3)
Input #3, vn$, vval$
setstring vn$, vval$
Wend
Close #3
dbug "inductavars end", "runtime"
'Open "inductavars.txt" For Output As 4

'read in script------------------------
mx = 0
readbatch batch$
'-----------------------------------------

pointer = 0

'Kill "c:\buzzscript_debug.txt"  'its opened for append in the module..

runscript mx


End Sub









