#NoEnv
#SingleInstance Force
dir:= "E:\bb\Drums2"
Loop Files, %dir%\*.MGU, R ; Recurse into subfolders.
{
WinActivate, ahk_class TBandWindow
WinMenuSelectItem, ahk_class TBandWindow, , File, Open
WinWait, ahk_class #32770
Sleep, 2000
SendRaw, %A_LoopFileFullPath%
Sleep, 2000
Send, {ENTER}
Sleep, 3000
Send, !2 : Solo Melody
Send, !8 : Solo Melody
Sleep, 1000
;MsgBox, Save
WinActivate, ahk_class TBandWindow
WinMenuSelectItem, ahk_class TBandWindow, , File, Save Special, Save Song as MIDI File
WinWait, ahk_class TMIDIexportDlg
Sleep, 2000
Send, {ENTER}
WinWait, ahk_class #32770
Sleep, 3000
Send, {ENTER}
Sleep, 2000
if WinExist("ahk_class TxForm") or WinExist("ahk_class" Overwrite file?)
{
;MsgBox, Overwrite?
WinActivate, ahk_class Overwrite file? ;TxForm
;Sleep, 500
Send, y
;WinWaitClose, ahk_class TxForm
}
Sleep, 1000
Send, !{F4}
Sleep, 2000