Jump to content

I think I'm done


Recommended Posts

I would like to thank everyone who has helped, but an especially big thanks to Valuator, JSThePatriot, Smoke_N; and also herewasplato for one solution that solved a lot of problems.

I'm pretty much done, just testing things out. Trying every situation that may arise with cpu, memory, and settings before I say I'm finally done. Until then, just looking to compact and optomize a little----besides my comments. As is, I have the idle CPU --of my app-- down to 00 and memory at 5,800K. Active the CPU peaks at 22.

The program is broken up into two main parts. The first is the interface with a few functions in it. The second is the grunt of the work to be done. This is done with BETA.

Thanks for any help.

#include <GUIConstants.au3>
#include <file.au3>
#include <array.au3>
#Include <Misc.au3>

$Jump_AutoExit = ""
If UBound(ProcessList("nam.exe")) > 2 Then
    MsgBox(262208, "Attention!", "N.A.M. is already running.", 15)
            $Jump_AutoExit = "Jump"
    Exit
EndIf
If Not ProcessExists("taskmgr.exe") Then Run("taskmgr.exe", "", @SW_HIDE)
Sleep(200)

Dim $szDrive, $szDir, $szFName, $szExt
$TestPath = _PathSplit(@ScriptFullPath, $szDrive, $szDir, $szFName, $szExt)
Global $hunt = $TestPath[1] & $TestPath[2] & "NAM.ini"
Global $Where = $hunt

$changeX = IniRead($Where, "Position", "X-Pos", 0)
$changeY = IniRead($Where, "Position", "Y-Pos", 0)
If $changeX > @DesktopWidth - 70 Or $changeX < 0 Then IniWrite($Where, "Position", "X-Pos", 0)
If $changeY > @DesktopWidth Or $changeY < 0 Then IniWrite($Where, "Position", "Y-Pos", 0)

;Opt("TrayIconDebug", 0)
Opt("TrayIconHide", 1)
Opt("RunErrorsFatal", 0);Not needed if using Smoke_N's "_RunWEC" function at bottom
Opt("OnExitFunc", "OnAutoItExit")
DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", 0)
$Title = "N.A.M. v1.0"
$Text = "Number of tracks in multitrack to mixdown."
$font1 = "Comic Sans MS"
$font2 = "Times New Roman"
$BGColor = 0xADC8DD
Global $Nlog1

;///////////////////////////////////////////////////////////////////////////////////////
;/////////////////////////////Files to install begins///////////////////////////////////
;///////////////////////////////////////////////////////////////////////////////////////

$Nuendo = @TempDir & "\nuendo.gif"
    If Not(FileExists($Nuendo)) Then
        FileInstall("C:\Documents and Settings\Money\Desktop\Gui test\Final\nuendo.gif", $Nuendo, 1)
    EndIf
$Indicator1 = @TempDir & "\indicator1.gif"
    If Not(FileExists($Indicator1)) Then
        FileInstall("C:\Documents and Settings\Money\Desktop\Gui test\Final\indicator1.gif", $Indicator1, 1)
    EndIf
$Indicator2 = @TempDir & "\indicator2.gif"
    If Not(FileExists($Indicator2)) Then
        FileInstall("C:\Documents and Settings\Money\Desktop\Gui test\Final\indicator2.gif", $Indicator2, 1)
    EndIf
$UpdateImage = @TempDir & "\nam.gif"
    If Not(FileExists($UpdateImage)) Then
        FileInstall("C:\Documents and Settings\Money\Desktop\Gui test\Final\nam.gif", $UpdateImage, 1)
    EndIf
$App2 = @TempDir & "\NAMx.exe"
    If Not(FileExists($App2)) Then
        FileInstall("C:\Documents and Settings\Money\Desktop\Gui test\Final\NAMx.exe", $App2, 1)
    EndIf

;///////////////////////////////////////////////////////////////////////////////////////
;/////////////////////////////Files to install ends/////////////////////////////////////
;///////////////////////////////////////////////////////////////////////////////////////



;///////////////////////////////////////////////////////////////////////////////////////
;/////////////////////////////Child GUI for sleep begins////////////////////////////////
;///////////////////////////////////////////////////////////////////////////////////////

$ChildSleepTime = GUICreate($Title & " - Sleep", 566, 580, IniRead($Where, "Position", "X-Pos", 0), IniRead($Where, "Position", "Y-Pos", 0)); this will put your window to the last stored coordinates (default: 0/0)
GUISetBkColor($BGColor)
Local $FL1 = 10 ;From left of first column
Local $FL2 = 235 ;From left of first column boxes
Local $FL3 = 290 ;From left of second column
Local $FL4 = 520 ;From left of second column boxes
Local $WidthL = 210 ;Width of label
Local $HeightL = 20 ;Height of label
Local $WidthI = 36 ;Width of input
Local $HeightI = 19 ;Height of input

GUICtrlCreatePic($Nuendo, 0, 0, 286, 580, $WS_EX_LAYERED)
$labelSleep0 = GUICtrlCreateLabel("Sleep Time  (In miliseconds, 1000=1sec.)", 10, 5, 370, 25)
GUICtrlSetFont(-1, 13, 800, "", $font1)
GUICtrlSetBkColor(-1, $BGColor)

$labelSleep1 = GUICtrlCreateLabel("General (placed throughout process).", $FL1, 35, $WidthL, $HeightL)
GUICtrlSetBkColor(-1, $BGColor)
$sleep1 = IniRead($Where, 'Sleep', 'SleepSend1', 'no')
$sleep2 = GUICtrlCreateInput($sleep1, $FL2, 35, $WidthI, $HeightI, $ES_NUMBER)

$labelSleep2 = GUICtrlCreateLabel("After mixer activation/deactivation.", $FL1, 60, $WidthL, $HeightL)
GUICtrlSetBkColor(-1, $BGColor)
$sleep3 = IniRead($Where, 'Sleep', 'SleepSend2', 'no')
$sleep4 = GUICtrlCreateInput($sleep3, $FL2, 60, $WidthI, $HeightI, $ES_NUMBER)

$labelSleep3 = GUICtrlCreateLabel("After select all.", $FL1, 85, $WidthL, $HeightL)
GUICtrlSetBkColor(-1, $BGColor)
$sleep5 = IniRead($Where, 'Sleep', 'SleepSend3', 'no')
$sleep6 = GUICtrlCreateInput($sleep5, $FL2, 85, $WidthI, $HeightI, $ES_NUMBER)

$labelSleep4 = GUICtrlCreateLabel("After select range location.", $FL1, 110, $WidthL, $HeightL)
GUICtrlSetBkColor(-1, $BGColor)
$sleep7 = IniRead($Where, 'Sleep', 'SleepSend4', 'no')
$sleep8 = GUICtrlCreateInput($sleep7, $FL2, 110, $WidthI, $HeightI, $ES_NUMBER)

$labelSleep5 = GUICtrlCreateLabel("After solo/unsolo.", $FL1, 135, $WidthL, $HeightL)
GUICtrlSetBkColor(-1, $BGColor)
$sleep9 = IniRead($Where, 'Sleep', 'SleepSend5', 'no')
$sleep10 = GUICtrlCreateInput($sleep9, $FL2, 135, $WidthI, $HeightI, $ES_NUMBER)

$labelSleep6 = GUICtrlCreateLabel("After select all on the track.", $FL1, 160, $WidthL, $HeightL)
GUICtrlSetBkColor(-1, $BGColor)
$sleep11 = IniRead($Where, 'Sleep', 'SleepSend6', 'no')
$sleep12 = GUICtrlCreateInput($sleep11, $FL2, 160, $WidthI, $HeightI, $ES_NUMBER)

$labelSleep7 = GUICtrlCreateLabel("After open/close edit view.", $FL1, 185, $WidthL, $HeightL)
GUICtrlSetBkColor(-1, $BGColor)
$sleep13 = IniRead($Where, 'Sleep', 'SleepSend7', 'no')
$sleep14 = GUICtrlCreateInput($sleep13, $FL2, 185, $WidthI, $HeightI, $ES_NUMBER)

$labelSleep8 = GUICtrlCreateLabel("After close export window.", $FL1, 210, $WidthL, $HeightL)
GUICtrlSetBkColor(-1, $BGColor)
$sleep15 = IniRead($Where, 'Sleep', 'SleepSend8', 'no')
$sleep16 = GUICtrlCreateInput($sleep15, $FL2, 210, $WidthI, $HeightI, $ES_NUMBER)

$labelSleep9 = GUICtrlCreateLabel("After replace in pool window.", $FL1, 235, $WidthL, $HeightL)
GUICtrlSetBkColor(-1, $BGColor)
$sleep17 = IniRead($Where, 'Sleep', 'SleepSend9', 'no')
$sleep18 = GUICtrlCreateInput($sleep17, $FL2, 235, $WidthI, $HeightI, $ES_NUMBER)

$labelSleep10 = GUICtrlCreateLabel("After exists in pool option.", $FL1, 260, $WidthL, $HeightL)
GUICtrlSetBkColor(-1, $BGColor)
$sleep19 = IniRead($Where, 'Sleep', 'SleepSend10', 'no')
$sleep20 = GUICtrlCreateInput($sleep19, $FL2, 260, $WidthI, $HeightI, $ES_NUMBER)

$labelSleep11 = GUICtrlCreateLabel("After export process window closes.", $FL1, 285, $WidthL, $HeightL)
GUICtrlSetBkColor(-1, $BGColor)
$sleep21 = IniRead($Where, 'Sleep', 'SleepSend11', 'no')
$sleep22 = GUICtrlCreateInput($sleep21, $FL2, 285, $WidthI, $HeightI, $ES_NUMBER)

$labelSleep12 = GUICtrlCreateLabel("After import options window closes.", $FL1, 310, $WidthL, $HeightL)
GUICtrlSetBkColor(-1, $BGColor)
$sleep23 = IniRead($Where, 'Sleep', 'SleepSend12', 'no')
$sleep24 = GUICtrlCreateInput($sleep23, $FL2, 310, $WidthI, $HeightI, $ES_NUMBER)

$labelSleep13 = GUICtrlCreateLabel("After move down to next track.", $FL1, 335, $WidthL, $HeightL)
GUICtrlSetBkColor(-1, $BGColor)
$sleep25 = IniRead($Where, 'Sleep', 'SleepSend13', 'no')
$sleep26 = GUICtrlCreateInput($sleep25, $FL2, 335, $WidthI, $HeightI, $ES_NUMBER)

$labelSleep14 = GUICtrlCreateLabel("OPTION -- After remove track.", $FL1, 360, $WidthL, $HeightL)
GUICtrlSetBkColor(-1, $BGColor)
$sleep27 = IniRead($Where, 'Sleep', 'SleepSend14', 'no')
$sleep28 = GUICtrlCreateInput($sleep27, $FL2, 360, $WidthI, $HeightI, $ES_NUMBER)

$labelSleep15 = GUICtrlCreateLabel("OPTION -- Remove unused media.", $FL1, 385, $WidthL, $HeightL)
GUICtrlSetBkColor(-1, $BGColor)
$sleep29 = IniRead($Where, 'Sleep', 'SleepSend15', 'no')
$sleep30 = GUICtrlCreateInput($sleep29, $FL2, 385, $WidthI, $HeightI, $ES_NUMBER)

$labelSleep16 = GUICtrlCreateLabel("OPTION -- After empty trash.", $FL1, 410, $WidthL, $HeightL)
GUICtrlSetBkColor(-1, $BGColor)
$sleep31 = IniRead($Where, 'Sleep', 'SleepSend16', 'no')
$sleep32 = GUICtrlCreateInput($sleep31, $FL2, 410, $WidthI, $HeightI, $ES_NUMBER)

$labelSleep17 = GUICtrlCreateLabel("OPTION -- After conform files.", $FL1, 435, $WidthL, $HeightL)
GUICtrlSetBkColor(-1, $BGColor)
$sleep33 = IniRead($Where, 'Sleep', 'SleepSend17', 'no')
$sleep34 = GUICtrlCreateInput($sleep33, $FL2, 435, $WidthI, $HeightI, $ES_NUMBER)

$labelSleep18 = GUICtrlCreateLabel("OPTION -- After prepare for archive.", $FL1, 460, $WidthL, $HeightL)
GUICtrlSetBkColor(-1, $BGColor)
$sleep35 = IniRead($Where, 'Sleep', 'SleepSend18', 'no')
$sleep36 = GUICtrlCreateInput($sleep35, $FL2, 460, $WidthI, $HeightI, $ES_NUMBER)

$labelSleep19 = GUICtrlCreateLabel("OPTION -- After no to freeze option.", $FL3, 35, $WidthL, $HeightL)
GUICtrlSetBkColor(-1, $BGColor)
$sleep37 = IniRead($Where, 'Sleep', 'SleepSend19', 'no')
$sleep38 = GUICtrlCreateInput($sleep37, $FL4, 35, $WidthI, $HeightI, $ES_NUMBER)

$labelSleep20 = GUICtrlCreateLabel("OPTION -- After yes to freeze option.", $FL3, 60, $WidthL, $HeightL)
GUICtrlSetBkColor(-1, $BGColor)
$sleep39 = IniRead($Where, 'Sleep', 'SleepSend20', 'no')
$sleep40 = GUICtrlCreateInput($sleep39, $FL4, 60, $WidthI, $HeightI, $ES_NUMBER)

$labelSleep21 = GUICtrlCreateLabel("OPTION -- Time for setting format/import.", $FL3, 85, $WidthL, $HeightL)
GUICtrlSetBkColor(-1, $BGColor)
$sleep41 = IniRead($Where, 'Sleep', 'SleepSend21', 'no')
$sleep42 = GUICtrlCreateInput($sleep41, $FL4, 85, $WidthI, $HeightI, $ES_NUMBER)

$labelSleep22 = GUICtrlCreateLabel("OPTION -- After MIDI merge.", $FL3, 110, $WidthL, $HeightL)
GUICtrlSetBkColor(-1, $BGColor)
$sleep43 = IniRead($Where, 'Sleep', 'SleepSend22', 'no')
$sleep44 = GUICtrlCreateInput($sleep43, $FL4, 110, $WidthI, $HeightI, $ES_NUMBER)

$labelSleep23 = GUICtrlCreateLabel("OPTION -- At MIDI merge option.", $FL3, 135, $WidthL, $HeightL)
GUICtrlSetBkColor(-1, $BGColor)
$sleep45 = IniRead($Where, 'Sleep', 'SleepSend23', 'no')
$sleep46 = GUICtrlCreateInput($sleep45, $FL4, 135, $WidthI, $HeightI, $ES_NUMBER)

$labelSleep24 = GUICtrlCreateLabel("Go to top of multitrack.", $FL3, 160, $WidthL, $HeightL)
GUICtrlSetBkColor(-1, $BGColor)
$sleep47 = IniRead($Where, 'Sleep', 'SleepSend24', 'no')
$sleep48 = GUICtrlCreateInput($sleep47, $FL4, 160, $WidthI, $HeightI, $ES_NUMBER)

$labelSleep25 = GUICtrlCreateLabel("Before mixdown of each track", $FL3, 185, $WidthL, $HeightL)
GUICtrlSetBkColor(-1, $BGColor)
$sleep49 = IniRead($Where, 'Sleep', 'SleepSend25', 'no')
$sleep50 = GUICtrlCreateInput($sleep49, $FL4, 185, $WidthI, $HeightI, $ES_NUMBER)

$labelSleep26 = GUICtrlCreateLabel("OPTION -- After create 2 track mixdown", $FL3, 210, $WidthL, $HeightL)
GUICtrlSetBkColor(-1, $BGColor)
$sleep51 = IniRead($Where, 'Sleep', 'SleepSend26', 'no')
$sleep52 = GUICtrlCreateInput($sleep51, $FL4, 210, $WidthI, $HeightI, $ES_NUMBER)

$labelSleep27 = GUICtrlCreateLabel("After open Sample/Key editor", $FL3, 235, $WidthL, $HeightL)
GUICtrlSetBkColor(-1, $BGColor)
$sleep53 = IniRead($Where, 'Sleep', 'SleepSend27', 'no')
$sleep54 = GUICtrlCreateInput($sleep53, $FL4, 235, $WidthI, $HeightI, $ES_NUMBER)

$labelSleep28 = GUICtrlCreateLabel("CPU Sleep time at 60%", $FL3, 260, $WidthL, $HeightL)
GUICtrlSetBkColor(-1, $BGColor)
$sleep55 = IniRead($Where, 'Sleep', 'SleepSend28', 'no')
$sleep56 = GUICtrlCreateInput($sleep55, $FL4, 260, $WidthI, $HeightI, $ES_NUMBER)

$labelSleep29 = GUICtrlCreateLabel("CPU Sleep time at 90%", $FL3, 285, $WidthL, $HeightL)
GUICtrlSetBkColor(-1, $BGColor)
$sleep57 = IniRead($Where, 'Sleep', 'SleepSend29', 'no')
$sleep58 = GUICtrlCreateInput($sleep57, $FL4, 285, $WidthI, $HeightI, $ES_NUMBER)

$SetCustomSleep = GUICtrlCreateButton("Store Custom Defaults", 356, 10, 114, 20) ;Custom Default
GUICtrlSetBkColor(-1, $BGColor)

$DefaultSleepTimes = GUICtrlCreateButton("Load Defaults", 476, 10, 80, 20) ;Default
GUICtrlSetBkColor(-1, $BGColor)

$SaveSleepTimes = GUICtrlCreateButton("Save", 150, 490, 80, 20) ;Submit
GUICtrlSetBkColor(-1, $BGColor)

$CancelSleepTimes = GUICtrlCreateButton("Cancel", 340, 490, 80, 20) ;Cancel
GUICtrlSetBkColor(-1, $BGColor)

GUISetState(@SW_HIDE)

;///////////////////////////////////////////////////////////////////////////////////////
;//////////////////////////////Child GUI for sleep ends/////////////////////////////////
;///////////////////////////////////////////////////////////////////////////////////////



;///////////////////////////////////////////////////////////////////////////////////////
;////////////////////////////Child GUI for Key Bindings begins//////////////////////////
;///////////////////////////////////////////////////////////////////////////////////////

$ChildKeyBindings = GUICreate($Title & " - Key Bindings", 566, 580, IniRead($Where, "Position", "X-Pos", 0), IniRead($Where, "Position", "Y-Pos", 0)); this will put your window to the last stored coordinates (default: 0/0)
GUISetBkColor($BGColor)
Local $FL1 = 10 ;From left of first column
Local $FL2 = 220 ;From left of first column boxes
Local $FL3 = 290 ;From left of second column
Local $FL4 = 503 ;From left of second column boxes
Local $WidthL = 210 ;Width of label
Local $HeightL = 20 ;Height of label
Local $WidthI = 53 ;Width of input
Local $HeightI = 19 ;Height of input

GUICtrlCreatePic($Nuendo, 0, 0, 286, 580, $WS_EX_LAYERED)
$labelKeyBindings0 = GUICtrlCreateLabel("Hot Keys For", 10, 5, 165, 25)
GUICtrlSetFont(-1, 13, 800, "", $font1)
GUICtrlSetBkColor(-1, $BGColor)

$labelKeyBindings1 = GUICtrlCreateLabel("Mixer", $FL1, 35, $WidthL, $HeightL)
GUICtrlSetBkColor(-1, $BGColor)
$keybindings1 = IniRead($Where, 'KeyBindings', 'KeyBindings1', 'no')
$keybindings2 = GUICtrlCreateInput($keybindings1, $FL2, 35, $WidthI, $HeightI)

$labelKeyBindings2 = GUICtrlCreateLabel("Bypass EQs", $FL1, 60, $WidthL, $HeightL)
GUICtrlSetBkColor(-1, $BGColor)
$keybindings3 = IniRead($Where, 'KeyBindings', 'KeyBindings2', 'no')
$keybindings4 = GUICtrlCreateInput($keybindings3, $FL2, 60, $WidthI, $HeightI)

$labelKeyBindings3 = GUICtrlCreateLabel("Bypass Inserts", $FL1, 85, $WidthL, $HeightL)
GUICtrlSetBkColor(-1, $BGColor)
$keybindings5 = IniRead($Where, 'KeyBindings', 'KeyBindings3', 'no')
$keybindings6 = GUICtrlCreateInput($keybindings5, $FL2, 85, $WidthI, $HeightI)

$labelKeyBindings4 = GUICtrlCreateLabel("Bypass Sends", $FL1, 110, $WidthL, $HeightL)
GUICtrlSetBkColor(-1, $BGColor)
$keybindings7 = IniRead($Where, 'KeyBindings', 'KeyBindings4', 'no')
$keybindings8 = GUICtrlCreateInput($keybindings7, $FL2, 110, $WidthI, $HeightI)

$labelKeyBindings6 = GUICtrlCreateLabel("Solo", $FL1, 135, $WidthL, $HeightL)
GUICtrlSetBkColor(-1, $BGColor)
$keybindings11 = IniRead($Where, 'KeyBindings', 'KeyBindings6', 'no')
$keybindings12 = GUICtrlCreateInput($keybindings11, $FL2, 135, $WidthI, $HeightI)

$labelKeyBindings19 = GUICtrlCreateLabel("Select All", $FL1, 160, $WidthL, $HeightL)
GUICtrlSetBkColor(-1, $BGColor)
$keybindings37 = IniRead($Where, 'KeyBindings', 'KeyBindings19', 'no')
$keybindings38 = GUICtrlCreateInput($keybindings37, $FL2, 160, $WidthI, $HeightI)

$labelKeyBindings7 = GUICtrlCreateLabel("Select All On Track", $FL1, 185, $WidthL, $HeightL)
GUICtrlSetBkColor(-1, $BGColor)
$keybindings13 = IniRead($Where, 'KeyBindings', 'KeyBindings7', 'no')
$keybindings14 = GUICtrlCreateInput($keybindings13, $FL2, 185, $WidthI, $HeightI)

$labelKeyBindings8 = GUICtrlCreateLabel("Open Editor", $FL1, 210, $WidthL, $HeightL)
GUICtrlSetBkColor(-1, $BGColor)
$keybindings15 = IniRead($Where, 'KeyBindings', 'KeyBindings8', 'no')
$keybindings16 = GUICtrlCreateInput($keybindings15, $FL2, 210, $WidthI, $HeightI)

$labelKeyBindings9 = GUICtrlCreateLabel("Export Audio", $FL1, 235, $WidthL, $HeightL)
GUICtrlSetBkColor(-1, $BGColor)
$keybindings17 = IniRead($Where, 'KeyBindings', 'KeyBindings9', 'no')
$keybindings18 = GUICtrlCreateInput($keybindings17, $FL2, 235, $WidthI, $HeightI)

$labelKeyBindings10 = GUICtrlCreateLabel("Enter", $FL1, 260, $WidthL, $HeightL)
GUICtrlSetBkColor(-1, $BGColor)
$keybindings19 = IniRead($Where, 'KeyBindings', 'KeyBindings10', 'no')
$keybindings20 = GUICtrlCreateInput($keybindings19, $FL2, 260, $WidthI, $HeightI)

$labelKeyBindings11 = GUICtrlCreateLabel("Remove Track", $FL1, 285, $WidthL, $HeightL)
GUICtrlSetBkColor(-1, $BGColor)
$keybindings21 = IniRead($Where, 'KeyBindings', 'KeyBindings11', 'no')
$keybindings22 = GUICtrlCreateInput($keybindings21, $FL2, 285, $WidthI, $HeightI)

$labelKeyBindings12 = GUICtrlCreateLabel("Remove Unused Media", $FL1, 310, $WidthL, $HeightL)
GUICtrlSetBkColor(-1, $BGColor)
$keybindings23 = IniRead($Where, 'KeyBindings', 'KeyBindings12', 'no')
$keybindings24 = GUICtrlCreateInput($keybindings23, $FL2, 310, $WidthI, $HeightI)

$labelKeyBindings13 = GUICtrlCreateLabel("Empty Trash", $FL1, 335, $WidthL, $HeightL)
GUICtrlSetBkColor(-1, $BGColor)
$keybindings25 = IniRead($Where, 'KeyBindings', 'KeyBindings13', 'no')
$keybindings26 = GUICtrlCreateInput($keybindings25, $FL2, 335, $WidthI, $HeightI)

$labelKeyBindings14 = GUICtrlCreateLabel("Conform Files", $FL1, 360, $WidthL, $HeightL)
GUICtrlSetBkColor(-1, $BGColor)
$keybindings27 = IniRead($Where, 'KeyBindings', 'KeyBindings14', 'no')
$keybindings28 = GUICtrlCreateInput($keybindings27, $FL2, 360, $WidthI, $HeightI)

$labelKeyBindings15 = GUICtrlCreateLabel("Prepare Archive", $FL1, 385, $WidthL, $HeightL)
GUICtrlSetBkColor(-1, $BGColor)
$keybindings29 = IniRead($Where, 'KeyBindings', 'KeyBindings15', 'no')
$keybindings30 = GUICtrlCreateInput($keybindings29, $FL2, 385, $WidthI, $HeightI)

$labelKeyBindings16 = GUICtrlCreateLabel("Save", $FL1, 410, $WidthL, $HeightL)
GUICtrlSetBkColor(-1, $BGColor)
$keybindings31 = IniRead($Where, 'KeyBindings', 'KeyBindings16', 'no')
$keybindings32 = GUICtrlCreateInput($keybindings31, $FL2, 410, $WidthI, $HeightI)

$labelKeyBindings17 = GUICtrlCreateLabel("Save As", $FL1, 435, $WidthL, $HeightL)
GUICtrlSetBkColor(-1, $BGColor)
$keybindings33 = IniRead($Where, 'KeyBindings', 'KeyBindings17', 'no')
$keybindings34 = GUICtrlCreateInput($keybindings33, $FL2, 435, $WidthI, $HeightI)

$labelKeyBindings18 = GUICtrlCreateLabel("Zoom Full", $FL3, 35, $WidthL, $HeightL)
GUICtrlSetBkColor(-1, $BGColor)
$keybindings35 = IniRead($Where, 'KeyBindings', 'KeyBindings18', 'no')
$keybindings36 = GUICtrlCreateInput($keybindings35, $FL4, 35, $WidthI, $HeightI)

$labelKeyBindings5 = GUICtrlCreateLabel("Top", $FL3, 60, $WidthL, $HeightL)
GUICtrlSetBkColor(-1, $BGColor)
$keybindings9 = IniRead($Where, 'KeyBindings', 'KeyBindings5', 'no')
$keybindings10 = GUICtrlCreateInput($keybindings9, $FL4, 60, $WidthI, $HeightI)

$labelKeyBindings20 = GUICtrlCreateLabel("Down", $FL3, 85, $WidthL, $HeightL)
GUICtrlSetBkColor(-1, $BGColor)
$keybindings39 = IniRead($Where, 'KeyBindings', 'KeyBindings20', 'no')
$keybindings40 = GUICtrlCreateInput($keybindings39, $FL4, 85, $WidthI, $HeightI)

$labelKeyBindings21 = GUICtrlCreateLabel("Tab", $FL3, 110, $WidthL, $HeightL)
GUICtrlSetBkColor(-1, $BGColor)
$keybindings41 = IniRead($Where, 'KeyBindings', 'KeyBindings21', 'no')
$keybindings42 = GUICtrlCreateInput($keybindings41, $FL4, 110, $WidthI, $HeightI)

$labelKeyBindings22 = GUICtrlCreateLabel("Return To Start Position", $FL3, 135, $WidthL, $HeightL)
GUICtrlSetBkColor(-1, $BGColor)
$keybindings43 = IniRead($Where, 'KeyBindings', 'KeyBindings22', 'no')
$keybindings44 = GUICtrlCreateInput($keybindings43, $FL4, 135, $WidthI, $HeightI)

$labelKeyBindings23 = GUICtrlCreateLabel("Locators To Selection", $FL3, 160, $WidthL, $HeightL)
GUICtrlSetBkColor(-1, $BGColor)
$keybindings45 = IniRead($Where, 'KeyBindings', 'KeyBindings23', 'no')
$keybindings46 = GUICtrlCreateInput($keybindings45, $FL4, 160, $WidthI, $HeightI)

$labelKeyBindings24 = GUICtrlCreateLabel("Merge MIDI In Loop", $FL3, 185, $WidthL, $HeightL)
GUICtrlSetBkColor(-1, $BGColor)
$keybindings47 = IniRead($Where, 'KeyBindings', 'KeyBindings24', 'no')
$keybindings48 = GUICtrlCreateInput($keybindings47, $FL4, 185, $WidthI, $HeightI)

$labelKeyBindingsNotes = GUICtrlCreateLabel("' ! ' = Alt    ' + ' = Shift    ' ^ ' = CTRL" & @LF & "Named and keyboard keys must be enclosed by '{}'", 280, 515, 280, 50)
GUICtrlSetBkColor(-1, $BGColor)
GUICtrlSetFont(-1, 10, 600, "", $font2)

$DefaultKeyBindings = GUICtrlCreateButton("Default", 476, 10, 80, 20) ;Default
GUICtrlSetBkColor(-1, $BGColor)

$SaveKeyBindings = GUICtrlCreateButton("Save", 150, 490, 80, 20) ;Submit
GUICtrlSetBkColor(-1, $BGColor)

$CancelKeyBindings = GUICtrlCreateButton("Cancel", 340, 490, 80, 20) ;Cancel
GUICtrlSetBkColor(-1, $BGColor)

GUISetState(@SW_HIDE)

;///////////////////////////////////////////////////////////////////////////////////////
;////////////////////////////Child GUI for keys bindings ends///////////////////////////
;///////////////////////////////////////////////////////////////////////////////////////



;///////////////////////////////////////////////////////////////////////////////////////
;/////////////////////////Child GUI for Settings begins/////////////////////////////////
;///////////////////////////////////////////////////////////////////////////////////////

$ChildSettings = GUICreate($Title & " - Settings", 283, 580, IniRead($Where, "Position", "X-Pos", 0), IniRead($Where, "Position", "Y-Pos", 0)); this will put your window to the last stored coordinates (default: 0/0)
GUISetBkColor($BGColor)
GUICtrlCreatePic($Nuendo, 0, 0, 286, 580, $WS_EX_LAYERED)
$labelSettings0 = GUICtrlCreateLabel("Settings", 10, 5, 280, 25)
GUICtrlSetFont(-1, 13, 800, "", $font1)
GUICtrlSetBkColor(-1, $BGColor)

$labelSettings1 = GUICtrlCreateLabel("Path to Nuendo. *", 10, 40, 280, 20)
GUICtrlSetBkColor(-1, $BGColor)
$settings1 = IniRead($Where, 'Settings', 'Settings1', 'no')
$settings2 = GUICtrlCreateInput($settings1, 10, 55, 236, 20)
$SetPathNuendo = GUICtrlCreateButton("Go", 250, 55, 22, 20, $BS_ICON) ;Set Nuendo path button
GUICtrlSetImage (-1, "shell32.dll",22)
GUICtrlSetFont(-1, 8, "", "", $font2)
GUICtrlSetBkColor(-1, $BGColor)

$labelSettings2 = GUICtrlCreateLabel("Path to two track editor.", 10, 85, 280, 20)
GUICtrlSetBkColor(-1, $BGColor)
$settings3 = IniRead($Where, 'Settings', 'Settings2', 'no')
$settings4 = GUICtrlCreateInput($settings3, 10, 100, 236, 20)
$SetPathEditor = GUICtrlCreateButton("Go", 250, 100, 22, 20, $BS_ICON) ;Set 2 track editor path button
GUICtrlSetImage (-1, "shell32.dll",22)
GUICtrlSetFont(-1, 8, "", "", $font2)
GUICtrlSetBkColor(-1, $BGColor)

$labelSettings3 = GUICtrlCreateLabel("Path to additional app to launch on mixdown completion.", 10, 130, 280, 20)
GUICtrlSetBkColor(-1, $BGColor)
$settings5 = IniRead($Where, 'Settings', 'Settings3', 'no')
$settings6 = GUICtrlCreateInput($settings5, 10, 145, 236, 19)
$SetPathAddApp = GUICtrlCreateButton("Go", 250, 145, 22, 20, $BS_ICON) ;Set additional app path button
GUICtrlSetImage (-1, "shell32.dll",22)
GUICtrlSetFont(-1, 8, "", "", $font2)
GUICtrlSetBkColor(-1, $BGColor)

$labelSettings4 = GUICtrlCreateLabel("Path to mixdown folder.   (No trailing slash) *", 10, 220, 280, 20)
GUICtrlSetBkColor(-1, $BGColor)
$settings7 = IniRead($Where, 'Settings', 'Settings4', 'no')
$settings8 = GUICtrlCreateInput($settings7, 10, 235, 238, 20, $ES_READONLY)
$SetPathMixdownFolder = GUICtrlCreateButton("Go", 252, 235, 20, 20, $BS_ICON, 0) ;Set mixdown button
GUICtrlSetImage (-1, "shell32.dll",4)
GUICtrlSetFont(-1, 8, "", "", $font2)
GUICtrlSetBkColor(-1, $BGColor)

$labelSettings5 = GUICtrlCreateLabel("Two track mixdown prefix.", 10, 265, 280, 20)
GUICtrlSetBkColor(-1, $BGColor)
$settings9 = IniRead($Where, 'Settings', 'Settings5', '')
$settings10 = GUICtrlCreateInput($settings9, 10, 280, 263, 19)

$labelSettings6 = GUICtrlCreateLabel("Audio file extension.   (without the ' . ')", 10, 310, 280, 20)
GUICtrlSetBkColor(-1, $BGColor)
$settings11 = IniRead($Where, 'Settings', 'Settings6', '')
$settings12 = GUICtrlCreateInput($settings11, 10, 325, 263, 19)

$labelSettings7 = GUICtrlCreateLabel("Path to main audio folder and/or Audio drive.", 10, 175, 280, 20)
GUICtrlSetBkColor(-1, $BGColor)
$settings13 = IniRead($Where, 'Settings', 'Settings7', 'no')
$settings14 = GUICtrlCreateInput($settings13, 10, 190, 236, 20)
$SetPathAudioFolder = GUICtrlCreateButton("Go", 252, 190, 20, 20, $BS_ICON) ;Set main audio path button
GUICtrlSetImage (-1, "shell32.dll",22)
GUICtrlSetFont(-1, 8, "", "", $font2)
GUICtrlSetBkColor(-1, $BGColor)

$labelSettings8 = GUICtrlCreateLabel("Drive to check space.   (ex. C:)", 10, 355, 240, 20)
GUICtrlSetBkColor(-1, $BGColor)
$settings15 = IniRead($Where, 'Settings', 'Settings8', 'no')
$settings16 = GUICtrlCreateInput($settings15, 247, 355, 25, 19)

$labelSettings9 = GUICtrlCreateLabel("Time to set format and import options.   (seconds)", 10, 390, 240, 20)
GUICtrlSetBkColor(-1, $BGColor)
$settings17 = IniRead($Where, 'Settings', 'Settings9', 'no')
$settings18 = GUICtrlCreateInput($settings17, 247, 390, 25, 19)

$SaveSettings = GUICtrlCreateButton("Save", 10, 440, 80, 20) ;Submit
GUICtrlSetBkColor(-1, $BGColor)

$CancelSettings = GUICtrlCreateButton("Cancel", 190, 440, 80, 20) ;Cancel
GUICtrlSetBkColor(-1, $BGColor)

$labelrestart = GUICtrlCreateLabel("*After you save/change these settimgs, N.A.M. must be restarted for settings to take affect.", 10, 470, 270, 30)

$Path_Holder_For_2nd_exe = GUICtrlCreateInput($hunt, 1, 1, 1, 1)

GUISetState(@SW_HIDE)

;///////////////////////////////////////////////////////////////////////////////////////
;//////////////////////Child GUI for Settings ends//////////////////////////////////////
;///////////////////////////////////////////////////////////////////////////////////////



$ChildUpdateCheck = GUICreate($Title & " - Update Check", 566, 500, IniRead($Where, "Position", "X-Pos", 0) + 50, IniRead($Where, "Position", "Y-Pos", 0) + 100)
GUISetBkColor($BGColor)
GUICtrlCreatePic($UpdateImage, 160, 80, 273, 296, $WS_EX_LAYERED)

$oIE = ObjCreate("Shell.Explorer.2")    

Func UpdateCheck()
;Local $labelC1
;Local $labelC2
;Local $labelUpdate
;Local $labelFixC

    $labelC1 = GUICtrlCreateLabel("Internet connection successful.", 10, 2, 280, 20)
    GUICtrlSetState ( $labelC1, $GUI_HIDE ) 
    $labelC2 = GUICtrlCreateLabel("Unable to connect to the internet.", 10, 2, 500, 20)
    GUICtrlSetState ( $labelC2, $GUI_HIDE )
    $labelUpdate = GUICtrlCreateLabel("ONLY if site is not active, you can check for updates through nam@execs.com.", 405, 435, 140, 40)
    GUICtrlSetState ( $labelUpdate, $GUI_HIDE )
    $labelFixC = GUICtrlCreateLabel("You must restart NAM after fixing your connection to check for updates.", 10, 480, 360, 15)
    GUICtrlSetState ( $labelFixC, $GUI_HIDE )
    

Ping("www.google.com")
If @error = 0 Or  @error = 1 Then
    GUICtrlSetState ( $labelC1, $GUI_SHOW )
    GUICtrlSetColor( $labelC1,0x1C8511)
    GUICtrlSetFont( $labelC1, 12, 800, "", $font2)

Else
    GUICtrlSetState ( $labelC2, $GUI_SHOW )
    GUICtrlSetColor($labelC2,0xff0000)
    GUICtrlSetFont( $labelC2, 12, 800, "", $font2)

    GUICtrlSetState ( $labelUpdate, $GUI_SHOW )
    GUICtrlSetColor( $labelUpdate,0xff0000)

    GUICtrlSetState ( $labelFixC, $GUI_SHOW )
    GUICtrlSetColor( $labelFixC,0xff0000)
EndIf
$GUIActiveX         = GUICtrlCreateObj      ( $oIE,      10, 25 , 546 , 400 )
;$oIE.navigate("http://www.esnips.com/web/Champak")
$oIE.navigate("http://www.google.com")
EndFunc

$labelUpdate = GUICtrlCreateLabel("N.A.M. Update Checker.", 100, 445, 298, 35)
GUICtrlSetFont(-1, 18, 800, "", $font1)

$CheckUpdate = GUICtrlCreateButton("Check", 10, 430, 80, 20) ;Check
GUICtrlSetBkColor(-1, $BGColor)

$CloseUpdate = GUICtrlCreateButton("Close", 10, 455, 80, 20) ;Close
GUICtrlSetBkColor(-1, $BGColor)

GUISetState(@SW_HIDE)

;///////////////////////////////////////////////////////////////////////////////////////
;//////////////////////Child GUI for Update Check ends//////////////////////////////////
;///////////////////////////////////////////////////////////////////////////////////////



$HelpPositionX = IniRead($Where, 'Position', 'X-Pos', 'no')
$HelpPositionY = IniRead($Where, 'Position', 'Y-Pos', 'no')


$Main = GUICreate($Title, 283, 580, IniRead($Where, "Position", "X-Pos", 0), IniRead($Where, "Position", "Y-Pos", 0)); this will put your window to the last stored coordinates (default: 0/0)
$ParentWin_Pos = WinGetPos($Main, "")


GUICtrlCreatePic($Nuendo, 0, 0, 286, 560, "", $WS_EX_LAYERED)

$labelprogress = GUICtrlCreateLabel("", 10, 475, 260, 20, "", $WS_EX_STATICEDGE) ;Mixdown progress
GUICtrlSetFont(-1, 9, 800)

GUICtrlCreateGroup("Optional", 10, 10, 261, 245)
GUICtrlSetBkColor(-1, $BGColor)

$control1 = IniRead($Where, 'Control', 'Control1', $GUI_UNCHECKED)
$control2 = GUICtrlCreateCheckbox("Automatically set full range locators.", 15, 27, 200, 15) ;Option - Set track locators
GUICtrlSetState($control2, $control1)
GUICtrlSetBkColor(-1, $BGColor)
$pic1 = GUICtrlCreatePic($Indicator1, 255, 29, 10, 10, $WS_EX_LAYERED)
GUICtrlSetState($pic1, $GUI_HIDE)

$control3 = IniRead($Where, 'Control', 'Control2', $GUI_UNCHECKED)
$control4 = GUICtrlCreateCheckbox("Set format of tracks and import options.", 15, 46, 200, 15) ;Option - Format setting
GUICtrlSetState($control4, $control3)
GUICtrlSetBkColor(-1, $BGColor)

$formatvalueRead = IniRead($Where, 'Control', 'Control22', $GUI_UNCHECKED)
$formatvalue = GUICtrlCreateInput($formatvalueRead, 220, 50, 1, 1)
GUICtrlSetState($formatvalue, $GUI_HIDE)
$pic2 = GUICtrlCreatePic($Indicator1, 255, 48, 10, 10, $WS_EX_LAYERED)
GUICtrlSetState($pic2, $GUI_HIDE)

$control5 = IniRead($Where, 'Control', 'Control3', $GUI_UNCHECKED)
$control6 = GUICtrlCreateCheckbox("Remove original tracks.", 15, 65, 130, 15) ;Option - Remove original track
GUICtrlSetState($control6, $control5)
GUICtrlSetBkColor(-1, $BGColor)
$control41 = IniRead($Where, 'Control', 'Control21', $GUI_UNCHECKED)
$control42 = GUICtrlCreateCheckbox("All Tracks.", 159, 65, 85, 15) ;Option - Remove original tracks mixer precausion
GUICtrlSetState($control42, $control41)
GUICtrlSetBkColor(-1, $BGColor)

$control7 = IniRead($Where, 'Control', 'Control4', $GUI_UNCHECKED)
$control8 = GUICtrlCreateCheckbox("Remove unused media from pool.", 15, 84, 200, 15) ;Option - Remove unused media
GUICtrlSetState($control8, $control7)
GUICtrlSetBkColor(-1, $BGColor)
$pic3 = GUICtrlCreatePic($Indicator1, 255, 86, 10, 10, $WS_EX_LAYERED)
GUICtrlSetState($pic3, $GUI_HIDE)

$control9 = IniRead($Where, 'Control', 'Control5', $GUI_UNCHECKED)
$control10 = GUICtrlCreateCheckbox("Empty trash.", 15, 103, 200, 15) ;Option - Empty trash
GUICtrlSetState($control10, $control9)
GUICtrlSetBkColor(-1, $BGColor)
$pic4 = GUICtrlCreatePic($Indicator1, 255, 105, 10, 10, $WS_EX_LAYERED)
GUICtrlSetState($pic4, $GUI_HIDE)

$control11 = IniRead($Where, 'Control', 'Control6', $GUI_UNCHECKED)
$control12 = GUICtrlCreateCheckbox("Conform files.", 15, 122, 200, 15) ;Option - Conform files
GUICtrlSetState($control12, $control11)
GUICtrlSetBkColor(-1, $BGColor)
$pic5 = GUICtrlCreatePic($Indicator1, 255, 124, 10, 10, $WS_EX_LAYERED)
GUICtrlSetState($pic5, $GUI_HIDE)

$control13 = IniRead($Where, 'Control', 'Control7', $GUI_UNCHECKED)
$control14 = GUICtrlCreateCheckbox("Prepare archive.", 15, 141, 95, 15) ;Option - Prepare Nuendo for archive
GUICtrlSetState($control14, $control13)
GUICtrlSetBkColor(-1, $BGColor)
$label1 = GUICtrlCreateLabel("====>", 117, 141, 35, 15, $ES_CENTER)
GUICtrlSetFont(-1, 8, 1200, "")
GUICtrlSetColor(-1, 0x1128FF)
GUICtrlSetBkColor(-1, $BGColor)
$control37 = IniRead($Where, 'Control', 'Control19', $GUI_UNCHECKED)
$control38 = GUICtrlCreateCheckbox("Freeze Edits.", 159, 141, 85, 15) ;Option - Prepare Nuendo for archive
GUICtrlSetState($control38, $control37)
GUICtrlSetBkColor(-1, $BGColor)
$pic6 = GUICtrlCreatePic($Indicator1, 255, 143, 10, 10, $WS_EX_LAYERED)
GUICtrlSetState($pic6, $GUI_HIDE)

$control15 = IniRead($Where, 'Control', 'Control8', $GUI_UNCHECKED)
$control16 = GUICtrlCreateCheckbox("Create a master 2 track.", 15, 160, 200, 15) ;Option - Export 2 track master
GUICtrlSetState($control16, $control15)
GUICtrlSetBkColor(-1, $BGColor)
$pic7 = GUICtrlCreatePic($Indicator1, 255, 162, 10, 10, $WS_EX_LAYERED)
GUICtrlSetState($pic7, $GUI_HIDE)

$control17 = IniRead($Where, 'Control', 'Control9', $GUI_UNCHECKED)
$control18 = GUICtrlCreateCheckbox("Edit 2 track mixdown in selected editor.", 15, 179, 200, 15) ;Option - 2 track editor
GUICtrlSetState($control18, $control17)
GUICtrlSetBkColor(-1, $BGColor)
$pic8 = GUICtrlCreatePic($Indicator1, 255, 181, 10, 10, $WS_EX_LAYERED)
GUICtrlSetState($pic8, $GUI_HIDE)

$control19 = IniRead($Where, 'Control', 'Control10', $GUI_UNCHECKED)
$control20 = GUICtrlCreateCheckbox("Open additional app after mixdown.", 15, 198, 200, 15) ;Option - Additional app
GUICtrlSetState($control20, $control19)
GUICtrlSetBkColor(-1, $BGColor)
$pic9 = GUICtrlCreatePic($Indicator1, 255, 200, 10, 10, $WS_EX_LAYERED)
GUICtrlSetState($pic9, $GUI_HIDE)

$control21 = IniRead($Where, 'Control', 'Control11', $GUI_UNCHECKED)
$control22 = GUICtrlCreateCheckbox("Del. to recycle bin.", 15, 217, 105, 15) ;Option - delete to recycle bin
GUICtrlSetState($control22, $control21)
GUICtrlSetBkColor(-1, $BGColor)
$label1 = GUICtrlCreateLabel("( OR )", 125, 217, 30, 20, $ES_CENTER)
GUICtrlSetFont(-1, 8, 1200, "")
GUICtrlSetColor(-1, 0x1128FF)
GUICtrlSetBkColor(-1, $BGColor)
$control23 = IniRead($Where, 'Control', 'Control12', $GUI_UNCHECKED)
$control24 = GUICtrlCreateCheckbox("Del. from HD.", 159, 217, 90, 15) ;Option - delete from HD
GUICtrlSetState($control24, $control23)
GUICtrlSetBkColor(-1, $BGColor)
$pic10 = GUICtrlCreatePic($Indicator1, 255, 219, 10, 10, $WS_EX_LAYERED)
GUICtrlSetState($pic10, $GUI_HIDE)

$control39 = IniRead($Where, 'Control', 'Control20', $GUI_UNCHECKED)
$control40 = GUICtrlCreateCheckbox("MIDI Merge.", 15, 236, 200, 15) ;Option - MIDI Tracks
GUICtrlSetState($control40, $control39)
GUICtrlSetBkColor(-1, $BGColor)
$pic12 = GUICtrlCreatePic($Indicator1, 255, 238, 10, 10, $WS_EX_LAYERED)
GUICtrlSetState($pic12, $GUI_HIDE)

$label1 = GUICtrlCreateLabel("Number of tracks in multitrack to mixdown.", 15, 260, 215, 20)
GUICtrlSetBkColor(-1, $BGColor)
$loop = GUICtrlCreateInput("", 240, 258, 27, 18, $ES_NUMBER) ;Input for loop
$pic11 = GUICtrlCreatePic($Indicator2, 241, 278, 25, 5, $WS_EX_LAYERED)
GUICtrlSetState($pic11, $GUI_HIDE)
GUICtrlSetBkColor(-1, $BGColor)

GUICtrlCreateGroup("Bypass Mixer Settings:", 10, 280, 261, 40)
GUICtrlSetBkColor(-1, $BGColor)

$control25 = IniRead($Where, 'Control', 'Control13', $GUI_UNCHECKED)
$control26 = GUICtrlCreateCheckbox("EQs", 15, 295) ;Mixer EQs checkbox
GUICtrlSetState($control26, $control25)
GUICtrlSetBkColor(-1, $BGColor)
$control27 = IniRead($Where, 'Control', 'Control14', $GUI_UNCHECKED)
$control28 = GUICtrlCreateCheckbox("Sends", 65, 295) ;Mixer sends checkbox
GUICtrlSetState($control28, $control27)
GUICtrlSetBkColor(-1, $BGColor)
$control29 = IniRead($Where, 'Control', 'Control15', $GUI_UNCHECKED)
$control30 = GUICtrlCreateCheckbox("Inserts", 125, 295) ;Mixer inserts checkbox
GUICtrlSetState($control30, $control29)
GUICtrlSetBkColor(-1, $BGColor)
$control31 = IniRead($Where, 'Control', 'Control16', $GUI_UNCHECKED)
$control32 = GUICtrlCreateCheckbox("Bypass All", 190, 295) ;Bypass all checkbox
GUICtrlSetState($control32, $control31)
GUICtrlSetBkColor(-1, $BGColor)

$control33 = IniRead($Where, 'Control', 'Control17', $GUI_UNCHECKED)
$control34 = GUICtrlCreateCheckbox("Save", 15, 323) ;Save checkbox
GUICtrlSetState($control34, $control33)
GUICtrlSetBkColor(-1, $BGColor)
$label4 = GUICtrlCreateLabel("( OR )", 66, 325, 30, "", $ES_CENTER)
GUICtrlSetFont(-1, 8, 1200, "")
GUICtrlSetBkColor(-1, $BGColor)
GUICtrlSetColor(-1, 0x1128FF)
$control35 = IniRead($Where, 'Control', 'Control18', $GUI_UNCHECKED)
$control36 = GUICtrlCreateCheckbox("Save As", 105, 323) ;Save As checkbox
GUICtrlSetState($control36, $control35)
GUICtrlSetBkColor(-1, $BGColor)
$saveasINPT = GUICtrlCreateInput("", 169, 325, 99, 18) ;Save as input

$clearall = GUICtrlCreateButton("Clear Checks", 101, 347, 80, 20) ;Clear all button
GUICtrlSetBkColor(-1, $BGColor)


$stop = GUICtrlCreateButton("Stop Mixdown", 190, 347, 80, 20) ;Cancel button
GUICtrlSetBkColor(-1, $BGColor)

$ok = GUICtrlCreateButton("OK", 10, 370, 80, 20) ;Submit button
GUICtrlSetBkColor(-1, $BGColor)

$setdefault = GUICtrlCreateButton("Set As Defaults", 101, 370, 80, 20) ;Submit button
GUICtrlSetBkColor(-1, $BGColor)

$cancel = GUICtrlCreateButton("Cancel", 190, 370, 80, 20) ;Cancel button
GUICtrlSetBkColor(-1, $BGColor)

$Path_Holder_For_2nd_exe = GUICtrlCreateInput($hunt, 1, 1, 1, 1)

;///////////////////////////////////////////////////////////////////////////////////////
;///////////////////////////////Begins menu display/////////////////////////////////////
;///////////////////////////////////////////////////////////////////////////////////////

$NFileLink1 = RegRead("HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32\OpenSaveMRU\npr", "MRUList")
$split = StringSplit($NFileLink1, "");splits off the MRUList registry so each link is readable individually below
Dim $log[UBound($split) ] ; since we are trying to get the info from $split use the amount of arrays that were made
For $logcount = 1 To UBound($split) - 1
    $log[$logcount] = RegRead("HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32\OpenSaveMRU\npr", $split[$logcount])
Next

$filemenu = GUICtrlCreateMenu("  &File  ")
$fileitem = GUICtrlCreateMenuitem("Open Nuendo", $filemenu)
$fileopen = GUICtrlCreateMenuitem("Open File", $filemenu)
Dim $recent[UBound($split) ]; since this is related to log split "626-629"
$recentfilesmenu = GUICtrlCreateMenu("Recent Files In Nuendo", $filemenu)
For $recentcount = 1 To UBound($split) - 1
    $recent[$recentcount] = GUICtrlCreateMenuitem($log[$recentcount], $recentfilesmenu)
Next
$restarter = GUICtrlCreateMenuitem("Restart Nuendo", $filemenu)
$sanitizeitem = GUICtrlCreateMenuitem("Sanitize Mixdown Folder", $filemenu)
$mixdownfolderitem = GUICtrlCreateMenuitem("Open Mixdown Folder", $filemenu)
$taskmanageritem = GUICtrlCreateMenuitem("Open Task Manager", $filemenu)
GUICtrlSetState(-1, $GUI_DEFBUTTON)

$settingsmenu = GUICtrlCreateMenu("  &Preference  ")
$sleepitem = GUICtrlCreateMenuitem("Sleep Times", $settingsmenu)
$keybindingsitem = GUICtrlCreateMenuitem("Nuendo Key Bindings", $settingsmenu)
$settingsitem = GUICtrlCreateMenuitem("Settings", $settingsmenu)
$updatecheckitem = GUICtrlCreateMenuitem("Update Check", $settingsmenu)
GUICtrlSetState(-1, $GUI_DEFBUTTON)

$helpmenu = GUICtrlCreateMenu("  ?  ")
$infoitem = GUICtrlCreateMenuitem("Help", $helpmenu)
$steinbergsmenu = GUICtrlCreateMenu("Steinberg", $helpmenu)
$steinberghome = GUICtrlCreateMenuitem("Home", $steinbergsmenu)
$steinbergforum = GUICtrlCreateMenuitem("Forum", $steinbergsmenu)

;///////////////////////////////////////////////////////////////////////////////////////
;///////////////////////////////Ends menu display///////////////////////////////////////
;///////////////////////////////////////////////////////////////////////////////////////



;///////////////////////////////////////////////////////////////////////////////////////
;//////////////////////////Hard drive space display begins//////////////////////////////
;///////////////////////////////////////////////////////////////////////////////////////

$Drive = IniRead($Where, "Settings", "Settings8", "NotFound")

$total = DriveSpaceTotal($Drive)
$free = DriveSpaceFree($Drive)
$used = $total - $free

$progress = GUICtrlCreateProgress(10, 445, 260, 15, $PBS_Smooth)
GUICtrlSetBkColor(-1, 0x009600)
GUICtrlSetColor(-1, 0xFF0000)

$labe5 = GUICtrlCreateLabel("Stats for Drive", 10, 460, 70, 15)
GUICtrlSetBkColor(-1, $BGColor)

$label4 = GUICtrlCreateLabel($settings15, 85, 460, 30, 15)
GUICtrlSetBkColor(-1, $BGColor)

GUICtrlSetData($progress, 100 * $used / DriveSpaceTotal($Drive))

$lbl_Used = GUICtrlCreateLabel(Round($used / 1024, 2) & " GB used ", 115, 460, 80, 15, $ES_CENTER)
GUICtrlSetBkColor(-1, $BGColor)
$lbl_Free = GUICtrlCreateLabel(Round($free / 1024, 2) & " GB free ", 193, 460, 80, 15, $ES_CENTER)
GUICtrlSetBkColor(-1, $BGColor)

;///////////////////////////////////////////////////////////////////////////////////////
;///////////////////////Hard drive space display ends///////////////////////////////////
;///////////////////////////////////////////////////////////////////////////////////////


GUISetState()

;======================Quick diagnostics begins=============================
;;;;
;;;;
Func GetPos()
Opt("MouseCoordMode", 2)
GUICtrlSetBkColor($labelprogress, 0xFFBA01)
Do
$msg = GUIGetMsg()
    $a=GUIGetCursorInfo()
    GUIctrlSetData($labelprogress,$a[0] & "  ,  " & $a[1] & "  ,  " & $a[4] )
        Sleep(100)
Until _IsPressed("10") And _IsPressed("44") ;Shift d
    GUIctrlSetData($labelprogress,"")
    GUICtrlSetBkColor($labelprogress, 0xD6D3CE)
EndFunc
;;;;
;;;;
;======================Quick diagnostics ends================================

;/////////////////////////////CPU and memory meter begins

$prolabel = GUICtrlCreateLabel("", 240, 422, 1, 1)
GUICtrlSetState($prolabel, $GUI_HIDE)
$prometer = GUICtrlCreateProgress(10, 395, 180, 10, $PBS_Smooth);to make bar vertical add ",0x04" to the end of the string
$labelCPU = GUICtrlCreateLabel("CPU Resource", 195, 393, 75, 15)
GUICtrlSetBkColor(-1, $BGColor)

$h_bar = GUICtrlCreateProgress(10, 410, 180, 10, $PBS_Smooth)
$labelRAM = GUICtrlCreateLabel("RAM Resource", 195, 408, 75, 15)
GUICtrlSetBkColor(-1, $BGColor)

GUISetFont(7, 400)
$start = GUICtrlCreateLabel("|", 10, 420, 10, 10)
GUICtrlSetBkColor(-1, $BGColor)
$0 = GUICtrlCreateLabel("0", 10, 430, 10, 10)
GUICtrlSetBkColor(-1, $BGColor)
$25 = GUICtrlCreateLabel("25", 50, 430, 10, 10)
GUICtrlSetBkColor(-1, $BGColor)
$50 = GUICtrlCreateLabel("50", 95, 430, 10, 10)
GUICtrlSetBkColor(-1, $BGColor)
$75 = GUICtrlCreateLabel("75", 140, 430, 10, 10)
GUICtrlSetBkColor(-1, $BGColor)
$100 = GUICtrlCreateLabel("100", 177, 430, 15, 10)
GUICtrlSetBkColor(-1, $BGColor)
$end = GUICtrlCreateLabel("|", 188, 420, 10, 10)
GUICtrlSetBkColor(-1, $BGColor)
GUISetFont(9, 400)
$label400 = GUICtrlCreateLabel("Percent", 195, 428, 40, 12)
GUICtrlSetBkColor(-1, $BGColor)

;/////////////////////////////CPU and memory meter ends

Func MixerBypass()
    If GUICtrlRead($control30) = $GUI_CHECKED Or GUICtrlRead($control26) = $GUI_CHECKED Or GUICtrlRead($control28) = $GUI_CHECKED Then
        WinActivate("Nuendo")
        Sleep($sleep1)
        Send($keybindings1) ;-N----Open mixer
        Sleep($sleep3)
        If GUICtrlRead($control30) = $GUI_CHECKED Then
            Send($keybindings5) ;-N----Bypass inserts
            Sleep(2)
        EndIf
        If GUICtrlRead($control26) = $GUI_CHECKED Then
            Send($keybindings3) ;-N----Bypass eqs
            Sleep(2)
        EndIf
        If GUICtrlRead($control28) = $GUI_CHECKED Then
            Send($keybindings7) ;-N----Bypass sends
            Sleep(2)
        EndIf
        Send($keybindings1) ;-N----Close mixer
        Sleep($sleep3)
        WinActivate($Title, $Text)
        Sleep(20)
    EndIf
EndFunc   ;==>MixerBypass

;///////////////////////////////////////////////////////////////////////////////////////
;///////////////////////////////While function begins///////////////////////////////////
;///////////////////////////////////////////////////////////////////////////////////////

If GUICtrlRead($control36) = $GUI_UNCHECKED Then
    GUICtrlSetState($saveasINPT, $GUI_DISABLE)
EndIf
If GUICtrlRead($control36) = $GUI_CHECKED Then
    GUICtrlSetState($saveasINPT, $GUI_ENABLE)
EndIf

AdlibEnable("Update")
While 1
    $msg = GUIGetMsg()

    ;/////////////////////////////Diagnostics Begins    
    If WinActive ($Title,$Text) Then
    If _IsPressed("12") And _IsPressed("44") Then GetPos() ; Alt d
    EndIf   
    ;/////////////////////////////Diagnostics Ends


    ;//////////////////////////////Menu item for recent files open in Nuendo begins
    For $iCount = 1 To UBound($split) - 1
        If $msg = $recent[$iCount] Then
            Run($settings1 & ' ' & $log[$iCount])
            If @error = 1 Then MsgBox(16, 'ERROR', 'You have not set the path to Nuendo.' & @LF & @LF & 'Go to settings in NAM to set the Nuendo path.')    
        
        EndIf
    Next
    ;//////////////////////////////Menu item for recent files open in Nuendo ends
    
    
    ;/////////////////////////////Set window position on exit begins
    Dim $a
    $a = WinGetPos($Main)
    ;/////////////////////////////Set window position on exit ends
    

    ;//////////////////////////////Link remove mixdown with all checkboxes begins
    ;6  =   Remove original tracks
    ;42 =   All tracks
    If GUICtrlRead($control42) = $GUI_CHECKED Then GUICtrlSetState($control6, $GUI_CHECKED) 
    ;//////////////////////////////Link remove mixdown with all checkboxes ends 
    
    
    ;//////////////////////////////Link delete with archive checkboxes begins
    ;22 =   Del. to recycle bin
    ;24 =   Del. from HD
    If GUICtrlRead($control24) = $GUI_CHECKED Then GUICtrlSetState($control14, $GUI_CHECKED)
    If GUICtrlRead($control22) = $GUI_CHECKED Then GUICtrlSetState($control14, $GUI_CHECKED)
    ;//////////////////////////////Link delete with archive checkboxes ends
    
    
    ;//////////////////////////////Link export audio with create 2 track master and remove original begins
    ;6  =   Remove original track after mixdown
    ;16 =   Create 2 track master
    ;18 =   Export Audio
    If GUICtrlRead($control18) = $GUI_CHECKED Then
        GUICtrlSetState($control16, $GUI_CHECKED)
        GUICtrlSetState($control6, $GUI_CHECKED)
    EndIf
    If GUICtrlRead($control16) = $GUI_CHECKED Then GUICtrlSetState($control6, $GUI_CHECKED) 
    ;//////////////////////////////Link export audio with create 2 track master and remove original ends
    
    
    ;//////////////////////////////Link of mixer bypass checkboxes begins   
    ;26 =   eqs
    ;28 =   Send
    ;30 =   inserts
    ;32 =   bypass
    If $msg = $control32 Then
        If GUICtrlRead($control32) = $GUI_CHECKED Then
            GUICtrlSetState($control26, $GUI_CHECKED)
            GUICtrlSetState($control30, $GUI_CHECKED)
            GUICtrlSetState($control28, $GUI_CHECKED)
        Else
            GUICtrlSetState($control26, $GUI_UNCHECKED)
            GUICtrlSetState($control30, $GUI_UNCHECKED)
            GUICtrlSetState($control28, $GUI_UNCHECKED)
        EndIf
    EndIf
    If $msg = $control26 Then
        If GUICtrlRead($control26) = $GUI_UNCHECKED Then GUICtrlSetState($control32, $GUI_UNCHECKED)
    EndIf
    If $msg = $control30 Then
        If GUICtrlRead($control30) = $GUI_UNCHECKED Then GUICtrlSetState($control32, $GUI_UNCHECKED)
    EndIf
    If $msg = $control28 Then
        If GUICtrlRead($control28) = $GUI_UNCHECKED Then GUICtrlSetState($control32, $GUI_UNCHECKED)
    EndIf   
    ;//////////////////////////////Link of mixer bypass checkboxes ends
    
    
    ;//////////////////////////////Set format and import option begins  
    If $msg = $control4 Then
        If GUICtrlRead($control4) = $GUI_CHECKED Then
            GUICtrlSetData($formatvalue, "1")
        Else
            GUICtrlSetData($formatvalue, "0")
        EndIf
    EndIf   
    ;//////////////////////////////Set format and import option ends


    ;/////////////////////////////"ENTER" to submit begins
    If _IsPressed("0D") And GUICtrlRead($loop) > 0 And Not ProcessExists("NAMx.exe") And WinActive($Title, $Text) Then
        Run(@TempDir & "\NAMx.exe")
    ElseIf _IsPressed("0D") And GUICtrlRead($loop) < 1 And Not ProcessExists("NAMx.exe") And WinActive($Title, $Text) Then
        NoInput()
    EndIf
    ;/////////////////////////////"ENTER" to submit ends
    
    Select
        
        ;//////////////////////////////MIDI Merge bypassing begins
        Case $msg = $control40
            If BitAND(GUICtrlRead($control40), $GUI_CHECKED) Then
                GUICtrlSetState($control4, $GUI_DISABLE + $GUI_UNCHECKED)
                GUICtrlSetState($control6, $GUI_DISABLE + $GUI_UNCHECKED)
                GUICtrlSetState($control8, $GUI_DISABLE + $GUI_UNCHECKED)
                GUICtrlSetState($control10, $GUI_DISABLE + $GUI_UNCHECKED)
                GUICtrlSetState($control12, $GUI_DISABLE + $GUI_UNCHECKED)
                GUICtrlSetState($control14, $GUI_DISABLE + $GUI_UNCHECKED)
                GUICtrlSetState($control16, $GUI_DISABLE + $GUI_UNCHECKED)
                GUICtrlSetState($control18, $GUI_DISABLE + $GUI_UNCHECKED)
                GUICtrlSetState($control20, $GUI_DISABLE + $GUI_UNCHECKED)
                GUICtrlSetState($control22, $GUI_DISABLE + $GUI_UNCHECKED)
                GUICtrlSetState($control24, $GUI_DISABLE + $GUI_UNCHECKED)
                GUICtrlSetState($control26, $GUI_DISABLE + $GUI_UNCHECKED)
                GUICtrlSetState($control28, $GUI_DISABLE + $GUI_UNCHECKED)
                GUICtrlSetState($control30, $GUI_DISABLE + $GUI_UNCHECKED)
                GUICtrlSetState($control32, $GUI_DISABLE + $GUI_UNCHECKED)
                GUICtrlSetState($control34, $GUI_DISABLE + $GUI_UNCHECKED)
                GUICtrlSetState($control36, $GUI_DISABLE + $GUI_UNCHECKED)
                GUICtrlSetState($control38, $GUI_DISABLE + $GUI_UNCHECKED)
                GUICtrlSetState($control42, $GUI_DISABLE + $GUI_UNCHECKED)
                GUICtrlSetData($saveasINPT, "")
                GUICtrlSetState($saveasINPT, $GUI_DISABLE)
                
            ElseIf BitAND(GUICtrlRead($control40), $GUI_UNCHECKED) Then
                GUICtrlSetState($control4, $GUI_ENABLE)
                GUICtrlSetState($control6, $GUI_ENABLE)
                GUICtrlSetState($control8, $GUI_ENABLE)
                GUICtrlSetState($control10, $GUI_ENABLE)
                GUICtrlSetState($control12, $GUI_ENABLE)
                GUICtrlSetState($control14, $GUI_ENABLE)
                GUICtrlSetState($control16, $GUI_ENABLE)
                GUICtrlSetState($control18, $GUI_ENABLE)
                GUICtrlSetState($control20, $GUI_ENABLE)
                GUICtrlSetState($control22, $GUI_ENABLE)
                GUICtrlSetState($control24, $GUI_ENABLE)
                GUICtrlSetState($control26, $GUI_ENABLE)
                GUICtrlSetState($control28, $GUI_ENABLE)
                GUICtrlSetState($control30, $GUI_ENABLE)
                GUICtrlSetState($control32, $GUI_ENABLE)
                GUICtrlSetState($control34, $GUI_ENABLE)
                GUICtrlSetState($control36, $GUI_ENABLE)
                GUICtrlSetState($control38, $GUI_ENABLE)
                GUICtrlSetState($control42, $GUI_ENABLE)                
            EndIf
        ;//////////////////////////////MIDI Merge bypassing ends
            
            ;14 =   Archive
            ;34 =   Save
            ;36 =   Save As
            ;38 =   Freeze
        Case $msg = $control38
            If BitAND(GUICtrlRead($control38), $GUI_CHECKED) Then GUICtrlSetState($control14, $GUI_CHECKED)
        Case $msg = $control14
            If BitAND(GUICtrlRead($control14), $GUI_UNCHECKED) Then GUICtrlSetState($control38, $GUI_UNCHECKED)
        Case $msg = $control24
            If BitAND(GUICtrlRead($control24), $GUI_CHECKED) Then GUICtrlSetState($control22, $GUI_UNCHECKED)
        Case $msg = $control22
            If BitAND(GUICtrlRead($control22), $GUI_CHECKED) Then GUICtrlSetState($control24, $GUI_UNCHECKED)
        Case $msg = $control34
            If BitAND(GUICtrlRead($control34), $GUI_CHECKED) Then GUICtrlSetState($control36, $GUI_UNCHECKED)
            GUICtrlSetState($saveasINPT, $GUI_DISABLE)
            GUICtrlSetData($saveasINPT, "")
        Case $msg = $control36
            If BitAND(GUICtrlRead($control36), $GUI_CHECKED) Then GUICtrlSetState($control34, $GUI_UNCHECKED)
            GUICtrlSetState($saveasINPT, $GUI_ENABLE)
            GUICtrlSetState($saveasINPT, $GUI_FOCUS)
            If GUICtrlRead($control36) = $GUI_UNCHECKED Then GUICtrlSetState($saveasINPT, $GUI_DISABLE)
            
        Case $msg = $ok;Starts mixdown function
            MixdownGo()
            
        Case $msg = $setdefault;Set Default
            SetDefault()
            
        Case $msg = $clearall;Clear Checkboxes
            ClearAll()
            
        Case $msg = $stop;Stop Mixdown
            StopMix()
            
        Case $msg = $GUI_EVENT_CLOSE Or $msg = $cancel;Cancel And Exit
            Exit
            
        Case $msg = $fileitem;Menu Items - Opens Nuendo
            Run($settings1)
            If @error = 1 Then MsgBox(16, 'ERROR', 'You have not set the path to Nuendo.' & @LF & @LF & 'Go to settings in NAM to set the Nuendo path.')    
            
        Case $msg = $fileopen;Menu Items - Open audio folder
            $openme = FileOpenDialog("Choose your session/multitrack.", $settings13, "(*.npr)")
            Run($settings1 & ' ' & $openme)
            If @error = 1 Then MsgBox(16, 'ERROR', 'You have not set the path to Nuendo.' & @LF & @LF & 'Go to settings in NAM to set the Nuendo path.')    
            
        Case $msg = $sanitizeitem;Menu Items - Sanitize Mixdown folder
            MixdownSanitize()
            
        Case $msg = $mixdownfolderitem;Menu Items - Opens Mixdown folder
            Run("explorer.exe " & $settings7)
            
        Case $msg = $taskmanageritem;Menu Items - Show task manager
            WinSetState("Windows Task Manager", "", @SW_SHOW)
            
        Case $msg = $restarter;Menu Items - Restart Nuendo and project
            RestartNuendo()
            
        Case $msg = $sleepitem;Menu Items - Opens preferences - Sleep
            GUISetState(@SW_HIDE, $Main)
            GUISetState(@SW_SHOW, $ChildSleepTime)
            
        Case $msg = $settingsitem;Menu Items - Opens preferences - Settings
            GUISetState(@SW_HIDE, $Main)
            GUISetState(@SW_SHOW, $ChildSettings)
            
        Case $msg = $keybindingsitem;Menu Items - Saves preferences - Keybindings
            GUISetState(@SW_HIDE, $Main)
            GUISetState(@SW_SHOW, $ChildKeyBindings)
            
        Case $msg = $updatecheckitem
            GUISetState(@SW_SHOW, $ChildUpdateCheck)            
            
        Case $msg = $infoitem;Menu Items - Opens help page
            Run('hh.exe NAM.chm')
            
        Case $msg = $steinberghome
            $ObjIE=ObjCreate("InternetExplorer.Application")
            With $ObjIE
              .Visible = True
              .Navigate("http://www.steinberg.net")
            EndWith
            
        Case $msg = $steinbergforum
            $ObjIE=ObjCreate("InternetExplorer.Application")
            With $ObjIE
              .Visible = True
              .Navigate("http://forum.nuendo.com/phpbb2/")
          EndWith
          
        ;;=============================================================================================Sleep Child
            
        Case $msg = $SaveSleepTimes;Saves preferences - Sleep and returns to main page
            GUISetState(@SW_HIDE, $ChildSleepTime)
            SaveSleepTimes()
            GUISetState(@SW_SHOW, $Main)    
        
        Case $msg = $SetCustomSleep;Saves custom sleep defaults
            SaveCustomSleep()
            
        Case $msg = $DefaultSleepTimes;Calls default sleep times
            DefaultSleepTimes()
            
        Case $msg = $CancelSleepTimes;Cancels preferences - Sleep and returns to main page
            GUISetState(@SW_HIDE, $ChildSleepTime)
            CancelSleepTimes()
            GUISetState(@SW_SHOW, $Main)
            
        ;;=============================================================================================Settings Child
            
        Case $msg = $SaveSettings;Saves preferences - Settings and returns to main page
            GUISetState(@SW_HIDE, $ChildSettings)
            SaveSettings()
            GUISetState(@SW_SHOW, $Main)    

        Case $msg = $SetPathNuendo
            NuendoPath()
            
        Case $msg = $SetPathEditor
            EditorPath()

        Case $msg = $SetPathAddApp
            AddAppPath()
            
        Case $msg = $SetPathAudioFolder
            AudioFolderPath()
            
        Case $msg = $SetPathMixdownFolder;Creates mixdown folder
            MixdownPath()
            
        Case $msg = $CancelSettings;Cancels preferences - Settings and returns to main page
            GUISetState(@SW_HIDE, $ChildSettings)
            CancelSettings()
            GUISetState(@SW_SHOW, $Main)
            
        ;;=============================================================================================Key Bindings Child
            
        Case $msg = $SaveKeyBindings;Saves preferences - Keybindings and returns to main page
            GUISetState(@SW_HIDE, $ChildKeyBindings)
            SaveKeyBindings()
            GUISetState(@SW_SHOW, $Main)    
            
        Case $msg = $DefaultKeyBindings
            DefaultKeyBindings()
            
        Case $msg = $CancelKeyBindings;Cancels preferences - Keybindings and returns to main page
            GUISetState(@SW_HIDE, $ChildKeyBindings)
            CancelKeyBindings()
            GUISetState(@SW_SHOW, $Main)
            
        ;;=============================================================================================Update Check Child
        
        Case $msg = $CheckUpdate
            UpdateCheck()
            
        Case $msg = $CloseUpdate
            GUISetState(@SW_HIDE, $ChildUpdateCheck)    
            
    EndSelect
WEnd

;///////////////////////////////////////////////////////////////////////////////////////
;///////////////////////////////While function ends/////////////////////////////////////
;///////////////////////////////////////////////////////////////////////////////////////

GUIDelete()

Func NoInput()
    
    GUICtrlSetState($loop, $GUI_FOCUS)
    Do
        GUICtrlSetBkColor($loop, 0xff0000)
        Sleep(200)
        GUICtrlSetBkColor($loop, 0xffffff)
        Sleep(200)
    Until GUICtrlRead($loop) > 0
    
EndFunc   ;==>NoInput

Func Update()
    
    ;===============================Memory monitor begins
    $ai_mem = MemGetStats()
    GUICtrlSetData($h_bar, $ai_mem[0])
    ;===============================Memory monitor ends
    
    ;===============================CPU monitor begins
    If Not ProcessExists("taskmgr.exe") Then Exit ;This will prevent autoit error because of not seeng the task manager
    $s = StatusbarGetText("Windows Task Manager", "", 2)
    $s = StringSplit($s, " ")
    $s = StringSplit($s[3], "%")
    GUICtrlSetData($prometer, $s[1])
    GUICtrlSetData($prolabel, $s[1])
    ;===============================CPU monitor ends
    
    ;===============================Restart Nuendo begins
    $RestartNFileOpen = RegRead("HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32\OpenSaveMRU\npr", "MRUList")
    $Nsplit = StringSplit($RestartNFileOpen, "");splits off the MRUList registry so each link is readable individually below
    
    For $UNUSEDVARIABLE = 1 To UBound($Nsplit) - 1
        $Nlog1 = RegRead("HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32\OpenSaveMRU\npr", $Nsplit[1])
    Next
    ;===============================Restart Nuendo ends

EndFunc   ;==>Update

Func RestartNuendo()
    
    If WinExists("Nuendo") Then
        $Restarting = MsgBox(4 + 48, "Restart", "Are you sure you want to restart Nuendo." & @LF & "Your project will automatically be saved.")
        If $Restarting = 6 Then
            GUICtrlSetData($labelprogress, "Shutting down Nuendo to restart.")
            WinClose("Nuendo")
            Sleep(2000)
            If WinExists("Nuendo", "Don't Save") Then
                Send($keybindings19)
            EndIf
            WinWaitClose("Nuendo")
            Sleep(2000)
            Run($settings1 & ' ' & $Nlog1)
            If @error = 1 Then MsgBox(16, 'ERROR', 'You have not set the path to Nuendo.' & @LF & @LF & 'Go to settings in NAM to set the Nuendo path.')    
            GUICtrlSetData($labelprogress, "Restarting Nuendo. Please wait.")
            WinWait("Initializing", "")
            WinWaitClose("Initializing", "")
            WinWait("Nuendo")
            GUICtrlSetData($labelprogress, "Nuendo has been restarted.")
            Sleep(3000)
            GUICtrlSetData($labelprogress, "Loading previous project. Please Wait")
            WinWaitClose("Loading Mixer", "")
            GUICtrlSetData($labelprogress, "Project restarted.")
            Sleep(3000)
        EndIf
        If $Restarting = 7 Then
            GUICtrlSetData($labelprogress, "Restart canceled.")
        EndIf
        Sleep(2000)
        GUICtrlSetData($labelprogress, "")
    Else
        ;
    EndIf
    
EndFunc   ;==>RestartNuendo

Func MixdownSanitize()

    $Jump_Sanitize = ""
    $size = DirGetSize($settings7, 1)
    If $size = -1 Then 
        GUICtrlSetData($labelprogress, "Unable to sanitize folder.")            
        MsgBox(16, "ERROR", 'You have not set the mixdown folder.' & @LF & @LF & 'Go to settings in NAM to set the mixdown folder.')
        $Jump_Sanitize = "Sanitize"
    EndIf
    If $Jump_Sanitize <> "Sanitize" Then
        If $size[1] > 0 Then
            GUICtrlSetData($labelprogress, "Sanitizing mixdown folder.")        
            $Sanitization = MsgBox(4 + 48, "Auto Mixdown", "Are you sure you want to sanitize?" & @LF _
                     & "This will wipe ALL files in mixdown folder from hard drive permanently." & @LF _
                     & "Size:   " & Round($size[0] / 1024 / 1024) & " MB" & @LF _
                     & "Files:  " & $size[1] & @LF _
                     & "Dirs:   " & $size[2])
            If $Sanitization = 6 Then
                FileDelete($settings7 & "\")
                GUICtrlSetData($labelprogress, "Sanitizing complete.")
            EndIf
            If $Sanitization = 7 Then
                GUICtrlSetData($labelprogress, "Sanatization canceled.")
            EndIf
        Else
            MsgBox(48, "Attention", "There are no files in the mixdown folder to sanitize.")
        EndIf
    EndIf
        Sleep(2000)
        GUICtrlSetData($labelprogress, "")      
    
EndFunc   ;==>MixdownSanitize

Func OnAutoItExit()
    
    If $Jump_AutoExit <> "Jump" Then
    ;===========================Automatically close Nuendo on exit begins
    If WinExists("Nuendo") Then
        $Restarting = MsgBox(4 + 48, "Nuendo Close", "Do you want to close Nuendo as well." & @LF & "Your project will automatically be saved if changes have been made.")
        If $Restarting = 6 Then
            WinClose("Nuendo")
            Sleep(1000)
            If WinExists("Nuendo", "Don't Save") Then
                Send($keybindings19)
            EndIf
        EndIf
    EndIf
    ;===========================Automatically close Nuendo on exit ends
    
    Sleep(200)
    
    ;===========================Remember position on NAM on exit begins
    If UBound(ProcessList("NAM.exe")) < 3 Then ;This will prevent autoit error if a 2nd NAM is executed
        IniWrite($Where, "Position", "X-Pos", $a[0])
        IniWrite($Where, "Position", "Y-Pos", $a[1])
    EndIf
    ;===========================Remember position on NAM on exit ends
    
    ;===========================Release taskmanager and delete files from Temp upon exit begins
        FileDelete(@TempDir & "\nuendo.gif")
        FileDelete(@TempDir & "\indicator1.gif")
        FileDelete(@TempDir & "\indicator2.gif")
        FileDelete(@TempDir & "\nam.gif")       
        FileDelete(@TempDir & "\NAMx.exe")
        Sleep(200)
        ProcessClose("taskmgr.exe")
    ;===========================Release taskmanager and delete files from Temp upon exit ends
    EndIf

EndFunc   ;==>OnAutoItExit

Func NuendoPath()

    $PathNuendo = FileOpenDialog("Find Nuendo", "c:\", "All (*.exe)")
    If @error = 1 Then 
        ;
    Else        
        GUICtrlSetData($settings2, $PathNuendo)
    EndIf   

EndFunc

Func EditorPath()
    
    $PathEditor = FileOpenDialog("Find Your 2 Track Editor", "c:\", "All (*.exe)")
    If @error = 1 Then 
        ;
    Else    
        GUICtrlSetData($settings4, $PathEditor)
    EndIf   

EndFunc

Func AddAppPath()
    
    $PathAddApp = FileOpenDialog("Find Your Additional App.", "c:\", "All (*.exe)")
    If @error = 1 Then 
        ;
    Else        
        GUICtrlSetData($settings6, $PathAddApp)
    EndIf   

EndFunc

Func AudioFolderPath()
    
    $PathAudioFolder = FileSelectFolder("Find Your Main Audio Folder.", "", 2 + 4)
    If @error = 1 Then 
        ;
    Else    
        GUICtrlSetData($settings14, $PathAudioFolder)
    EndIf
    
EndFunc 
    

Func MixdownPath()
    
    $PathMixdownFolder = FileSelectFolder("Choose OR create your mixdown folder.", "", 1 + 2 + 4)
    If @error = 1 Then 
        ;
    Else
        GUICtrlSetData($settings8, $PathMixdownFolder)      
        $MP = IniWrite($Where, 'Settings', 'Settings4', GUICtrlRead($settings8))
        Sleep(200)  
        MsgBox(64, "Auto Mixdown", "'" & $PathMixdownFolder & "' has been selected as your Mixdown Folder.")            
    EndIf
    
EndFunc   ;==>MixdownPath

;;=============================================================================================OK

Func MixdownGo()
    
    If Not WinExists ("Nuendo") then
        MsgBox(48, "Attention", "N.A.M. has detected there is no Nuendo project open.")
    ElseIf  (StringLen(GUICtrlRead($loop)) == 0) Then
        MsgBox(48, "Required", "You must indicate the amount of tracks to mixdown.")
        NoInput()
    Else
        GUICtrlSetState($control2, $GUI_DISABLE)
        GUICtrlSetState($control4, $GUI_DISABLE)
        GUICtrlSetState($control6, $GUI_DISABLE)
        GUICtrlSetState($control8, $GUI_DISABLE)
        GUICtrlSetState($control10, $GUI_DISABLE)
        GUICtrlSetState($control12, $GUI_DISABLE)
        GUICtrlSetState($control14, $GUI_DISABLE)
        GUICtrlSetState($control16, $GUI_DISABLE)
        GUICtrlSetState($control18, $GUI_DISABLE)
        GUICtrlSetState($control20, $GUI_DISABLE)
        GUICtrlSetState($control22, $GUI_DISABLE)
        GUICtrlSetState($control24, $GUI_DISABLE)
        GUICtrlSetState($control26, $GUI_DISABLE)
        GUICtrlSetState($control28, $GUI_DISABLE)
        GUICtrlSetState($control30, $GUI_DISABLE)
        GUICtrlSetState($control32, $GUI_DISABLE)
        GUICtrlSetState($control34, $GUI_DISABLE)
        GUICtrlSetState($control36, $GUI_DISABLE)
        GUICtrlSetState($control38, $GUI_DISABLE)
        GUICtrlSetState($control40, $GUI_DISABLE)
        GUICtrlSetState($control42, $GUI_DISABLE)       
        GUICtrlSetState($loop, $GUI_DISABLE)
        GUICtrlSetState($saveasINPT, $GUI_DISABLE)
        GUICtrlSetState($ok, $GUI_DISABLE)
        GUICtrlSetState($setdefault, $GUI_DISABLE)
        GUICtrlSetState($clearall, $GUI_DISABLE)
        GUICtrlSetState($cancel, $GUI_DISABLE)
        Run(@TempDir & "\NAMx.exe")
        If @error = 1 Then 
            MsgBox(16, 'ERROR', 'Fatal error. Unable to mixdown.')
            GUICtrlSetState($control2, $GUI_ENABLE)
            GUICtrlSetState($control4, $GUI_ENABLE)
            GUICtrlSetState($control6, $GUI_ENABLE)
            GUICtrlSetState($control8, $GUI_ENABLE)
            GUICtrlSetState($control10, $GUI_ENABLE)
            GUICtrlSetState($control12, $GUI_ENABLE)
            GUICtrlSetState($control14, $GUI_ENABLE)
            GUICtrlSetState($control16, $GUI_ENABLE)
            GUICtrlSetState($control18, $GUI_ENABLE)
            GUICtrlSetState($control20, $GUI_ENABLE)
            GUICtrlSetState($control22, $GUI_ENABLE)
            GUICtrlSetState($control24, $GUI_ENABLE)
            GUICtrlSetState($control26, $GUI_ENABLE)
            GUICtrlSetState($control28, $GUI_ENABLE)
            GUICtrlSetState($control30, $GUI_ENABLE)
            GUICtrlSetState($control32, $GUI_ENABLE)
            GUICtrlSetState($control34, $GUI_ENABLE)
            GUICtrlSetState($control36, $GUI_ENABLE)
            GUICtrlSetState($control38, $GUI_ENABLE)
            GUICtrlSetState($control40, $GUI_ENABLE)
            GUICtrlSetState($control42, $GUI_ENABLE)        
            GUICtrlSetState($loop, $GUI_ENABLE)
            GUICtrlSetState($saveasINPT, $GUI_ENABLE)
            GUICtrlSetState($ok, $GUI_ENABLE)
            GUICtrlSetState($setdefault, $GUI_ENABLE)
            GUICtrlSetState($clearall, $GUI_ENABLE)
            GUICtrlSetState($cancel, $GUI_ENABLE)
        EndIf
    EndIf
    
EndFunc   ;==>MixdownGo

;;=============================================================================================Set Default

Func SetDefault()
    
    IniWrite($Where, "Control", "Control1", GUICtrlRead($control2))
    IniWrite($Where, "Control", "Control2", GUICtrlRead($control4))
    IniWrite($Where, "Control", "Control3", GUICtrlRead($control6))
    IniWrite($Where, "Control", "Control4", GUICtrlRead($control8))
    IniWrite($Where, "Control", "Control5", GUICtrlRead($control10))
    IniWrite($Where, "Control", "Control6", GUICtrlRead($control12))
    IniWrite($Where, "Control", "Control7", GUICtrlRead($control14))
    IniWrite($Where, "Control", "Control8", GUICtrlRead($control16))
    IniWrite($Where, "Control", "Control9", GUICtrlRead($control18))
    IniWrite($Where, "Control", "Control10", GUICtrlRead($control20))
    IniWrite($Where, "Control", "Control11", GUICtrlRead($control22))
    IniWrite($Where, "Control", "Control12", GUICtrlRead($control24))
    IniWrite($Where, "Control", "Control13", GUICtrlRead($control26))
    IniWrite($Where, "Control", "Control14", GUICtrlRead($control28))
    IniWrite($Where, "Control", "Control15", GUICtrlRead($control30))
    IniWrite($Where, "Control", "Control16", GUICtrlRead($control32))
    IniWrite($Where, "Control", "Control17", GUICtrlRead($control34))
    IniWrite($Where, "Control", "Control18", GUICtrlRead($control36))
    IniWrite($Where, "Control", "Control19", GUICtrlRead($control38))
    IniWrite($Where, "Control", "Control20", GUICtrlRead($control40))
    IniWrite($Where, "Control", "Control21", GUICtrlRead($control42))   
    IniWrite($Where, "Control", "Control22", GUICtrlRead($formatvalue))
    
EndFunc   ;==>SetDefault

;;=============================================================================================Clear Checkboxes

Func ClearAll()
    
    GUICtrlSetState($control2, $GUI_UNCHECKED + $GUI_ENABLE)
    GUICtrlSetState($control4, $GUI_UNCHECKED + $GUI_ENABLE)
    GUICtrlSetState($control6, $GUI_UNCHECKED + $GUI_ENABLE)
    GUICtrlSetState($control8, $GUI_UNCHECKED + $GUI_ENABLE)
    GUICtrlSetState($control10, $GUI_UNCHECKED + $GUI_ENABLE)
    GUICtrlSetState($control12, $GUI_UNCHECKED + $GUI_ENABLE)
    GUICtrlSetState($control14, $GUI_UNCHECKED + $GUI_ENABLE)
    GUICtrlSetState($control16, $GUI_UNCHECKED + $GUI_ENABLE)
    GUICtrlSetState($control18, $GUI_UNCHECKED + $GUI_ENABLE)
    GUICtrlSetState($control20, $GUI_UNCHECKED + $GUI_ENABLE)
    GUICtrlSetState($control22, $GUI_UNCHECKED + $GUI_ENABLE)
    GUICtrlSetState($control24, $GUI_UNCHECKED + $GUI_ENABLE)
    GUICtrlSetState($control26, $GUI_UNCHECKED + $GUI_ENABLE)
    GUICtrlSetState($control28, $GUI_UNCHECKED + $GUI_ENABLE)
    GUICtrlSetState($control30, $GUI_UNCHECKED + $GUI_ENABLE)
    GUICtrlSetState($control32, $GUI_UNCHECKED + $GUI_ENABLE)
    GUICtrlSetState($control34, $GUI_UNCHECKED + $GUI_ENABLE)
    GUICtrlSetState($control36, $GUI_UNCHECKED + $GUI_ENABLE)
    GUICtrlSetState($control38, $GUI_UNCHECKED + $GUI_ENABLE)
    GUICtrlSetState($control40, $GUI_UNCHECKED + $GUI_ENABLE)
    GUICtrlSetState($control42, $GUI_UNCHECKED + $GUI_ENABLE)
    GUICtrlSetState($pic1, $GUI_HIDE)
    GUICtrlSetState($pic2, $GUI_HIDE)
    GUICtrlSetState($pic2, $GUI_HIDE)
    GUICtrlSetState($pic3, $GUI_HIDE)
    GUICtrlSetState($pic4, $GUI_HIDE)
    GUICtrlSetState($pic5, $GUI_HIDE)
    GUICtrlSetState($pic6, $GUI_HIDE)
    GUICtrlSetState($pic7, $GUI_HIDE)
    GUICtrlSetState($pic8, $GUI_HIDE)
    GUICtrlSetState($pic9, $GUI_HIDE)
    GUICtrlSetState($pic10, $GUI_HIDE)
    GUICtrlSetState($pic11, $GUI_HIDE)
    GUICtrlSetState($pic12, $GUI_HIDE)
    GUICtrlSetData($formatvalue, "0")
    GUICtrlSetData($saveasINPT, "")
    GUICtrlSetState($saveasINPT, $GUI_DISABLE)
    
EndFunc   ;==>ClearAll

;;=============================================================================================Stop Mixdown

Func StopMix()
    
    If ProcessExists("NAMx.exe") Then
        If GUICtrlRead($control40) = $GUI_UNCHECKED Then
            ProcessClose("NAMx.exe")
            GUICtrlSetState($control2, $GUI_ENABLE)
            GUICtrlSetState($control4, $GUI_ENABLE)
            GUICtrlSetState($control6, $GUI_ENABLE)
            GUICtrlSetState($control8, $GUI_ENABLE)
            GUICtrlSetState($control10, $GUI_ENABLE)
            GUICtrlSetState($control12, $GUI_ENABLE)
            GUICtrlSetState($control14, $GUI_ENABLE)
            GUICtrlSetState($control16, $GUI_ENABLE)
            GUICtrlSetState($control18, $GUI_ENABLE)
            GUICtrlSetState($control20, $GUI_ENABLE)
            GUICtrlSetState($control22, $GUI_ENABLE)
            GUICtrlSetState($control24, $GUI_ENABLE)
            GUICtrlSetState($control26, $GUI_ENABLE)
            GUICtrlSetState($control28, $GUI_ENABLE)
            GUICtrlSetState($control30, $GUI_ENABLE)
            GUICtrlSetState($control32, $GUI_ENABLE)
            GUICtrlSetState($control34, $GUI_ENABLE)
            GUICtrlSetState($control36, $GUI_ENABLE)
            GUICtrlSetState($control38, $GUI_ENABLE)
            GUICtrlSetState($control40, $GUI_ENABLE)
            GUICtrlSetState($control42, $GUI_ENABLE)            
            GUICtrlSetState($loop, $GUI_ENABLE)
            If GUICtrlRead($control36) = $GUI_CHECKED Then
                GUICtrlSetState($saveasINPT, $GUI_ENABLE)
            EndIf
            GUICtrlSetState($ok, $GUI_ENABLE)
            GUICtrlSetState($clearall, $GUI_ENABLE)
            GUICtrlSetState($setdefault, $GUI_ENABLE)
            GUICtrlSetState($cancel, $GUI_ENABLE)
            MixerBypass()
            GUICtrlSetData($labelprogress, "Mixdown process has been stopped.")
        ElseIf GUICtrlRead($control40) = $GUI_CHECKED Then
            ProcessClose("NAMx.exe")
            GUICtrlSetState($control2, $GUI_ENABLE)
            GUICtrlSetState($control26, $GUI_ENABLE)
            GUICtrlSetState($control28, $GUI_ENABLE)
            GUICtrlSetState($control30, $GUI_ENABLE)
            GUICtrlSetState($control32, $GUI_ENABLE)
            GUICtrlSetState($control34, $GUI_ENABLE)
            GUICtrlSetState($control36, $GUI_ENABLE)
            GUICtrlSetState($control38, $GUI_ENABLE)
            GUICtrlSetState($control40, $GUI_ENABLE)
            GUICtrlSetState($loop, $GUI_ENABLE)
            If GUICtrlRead($control36) = $GUI_CHECKED Then
                GUICtrlSetState($saveasINPT, $GUI_ENABLE)
            EndIf
            GUICtrlSetState($ok, $GUI_ENABLE)
            GUICtrlSetState($clearall, $GUI_ENABLE)
            GUICtrlSetState($setdefault, $GUI_ENABLE)
            GUICtrlSetState($cancel, $GUI_ENABLE)
            MixerBypass()
            GUICtrlSetData($labelprogress, "MIDI merge has been stopped.")
        EndIf
    EndIf
    
EndFunc   ;==>StopMix

;;=============================================================================================Sleep Child

Func SaveSleepTimes()
    
    IniWrite($Where, 'Sleep', 'SleepSend1', GUICtrlRead($sleep2))
    IniWrite($Where, 'Sleep', 'SleepSend2', GUICtrlRead($sleep4))
    IniWrite($Where, 'Sleep', 'SleepSend3', GUICtrlRead($sleep6))
    IniWrite($Where, 'Sleep', 'SleepSend4', GUICtrlRead($sleep8))
    IniWrite($Where, 'Sleep', 'SleepSend5', GUICtrlRead($sleep10))
    IniWrite($Where, 'Sleep', 'SleepSend6', GUICtrlRead($sleep12))
    IniWrite($Where, 'Sleep', 'SleepSend7', GUICtrlRead($sleep14))
    IniWrite($Where, 'Sleep', 'SleepSend8', GUICtrlRead($sleep16))
    IniWrite($Where, 'Sleep', 'SleepSend9', GUICtrlRead($sleep18))
    IniWrite($Where, 'Sleep', 'SleepSend10', GUICtrlRead($sleep20))
    IniWrite($Where, 'Sleep', 'SleepSend11', GUICtrlRead($sleep22))
    IniWrite($Where, 'Sleep', 'SleepSend12', GUICtrlRead($sleep24))
    IniWrite($Where, 'Sleep', 'SleepSend13', GUICtrlRead($sleep26))
    IniWrite($Where, 'Sleep', 'SleepSend14', GUICtrlRead($sleep28))
    IniWrite($Where, 'Sleep', 'SleepSend15', GUICtrlRead($sleep30))
    IniWrite($Where, 'Sleep', 'SleepSend16', GUICtrlRead($sleep32))
    IniWrite($Where, 'Sleep', 'SleepSend17', GUICtrlRead($sleep34))
    IniWrite($Where, 'Sleep', 'SleepSend18', GUICtrlRead($sleep36))
    IniWrite($Where, 'Sleep', 'SleepSend19', GUICtrlRead($sleep38))
    IniWrite($Where, 'Sleep', 'SleepSend20', GUICtrlRead($sleep40))
    IniWrite($Where, 'Sleep', 'SleepSend21', GUICtrlRead($sleep42))
    IniWrite($Where, 'Sleep', 'SleepSend22', GUICtrlRead($sleep44))
    IniWrite($Where, 'Sleep', 'SleepSend23', GUICtrlRead($sleep46))
    IniWrite($Where, 'Sleep', 'SleepSend24', GUICtrlRead($sleep48))
    IniWrite($Where, 'Sleep', 'SleepSend25', GUICtrlRead($sleep50))
    IniWrite($Where, 'Sleep', 'SleepSend26', GUICtrlRead($sleep52))
    IniWrite($Where, 'Sleep', 'SleepSend27', GUICtrlRead($sleep54))
    IniWrite($Where, 'Sleep', 'SleepSend28', GUICtrlRead($sleep56))
    IniWrite($Where, 'Sleep', 'SleepSend29', GUICtrlRead($sleep58))
    
EndFunc   ;==>SaveSleepTimes

Func SaveCustomSleep()
    
    IniWrite($Where, "CustomSleep", "CustomSleep1", GUICtrlRead($sleep2))
    IniWrite($Where, "CustomSleep", "CustomSleep2", GUICtrlRead($sleep4))
    IniWrite($Where, "CustomSleep", "CustomSleep3", GUICtrlRead($sleep6))
    IniWrite($Where, "CustomSleep", "CustomSleep4", GUICtrlRead($sleep8))
    IniWrite($Where, "CustomSleep", "CustomSleep5", GUICtrlRead($sleep10))
    IniWrite($Where, "CustomSleep", "CustomSleep6", GUICtrlRead($sleep12))
    IniWrite($Where, "CustomSleep", "CustomSleep7", GUICtrlRead($sleep14))
    IniWrite($Where, "CustomSleep", "CustomSleep8", GUICtrlRead($sleep16))
    IniWrite($Where, "CustomSleep", "CustomSleep9", GUICtrlRead($sleep18))
    IniWrite($Where, "CustomSleep", "CustomSleep10", GUICtrlRead($sleep20))
    IniWrite($Where, "CustomSleep", "CustomSleep11", GUICtrlRead($sleep22))
    IniWrite($Where, "CustomSleep", "CustomSleep12", GUICtrlRead($sleep24))
    IniWrite($Where, "CustomSleep", "CustomSleep13", GUICtrlRead($sleep26))
    IniWrite($Where, "CustomSleep", "CustomSleep14", GUICtrlRead($sleep28))
    IniWrite($Where, "CustomSleep", "CustomSleep15", GUICtrlRead($sleep30))
    IniWrite($Where, "CustomSleep", "CustomSleep16", GUICtrlRead($sleep32))
    IniWrite($Where, "CustomSleep", "CustomSleep17", GUICtrlRead($sleep34))
    IniWrite($Where, "CustomSleep", "CustomSleep18", GUICtrlRead($sleep36))
    IniWrite($Where, "CustomSleep", "CustomSleep19", GUICtrlRead($sleep38))
    IniWrite($Where, "CustomSleep", "CustomSleep20", GUICtrlRead($sleep40))
    IniWrite($Where, "CustomSleep", "CustomSleep21", GUICtrlRead($sleep42))
    IniWrite($Where, "CustomSleep", "CustomSleep22", GUICtrlRead($sleep44))
    IniWrite($Where, "CustomSleep", "CustomSleep23", GUICtrlRead($sleep46))
    IniWrite($Where, "CustomSleep", "CustomSleep24", GUICtrlRead($sleep48))
    IniWrite($Where, "CustomSleep", "CustomSleep25", GUICtrlRead($sleep50))
    IniWrite($Where, "CustomSleep", "CustomSleep26", GUICtrlRead($sleep52))
    IniWrite($Where, "CustomSleep", "CustomSleep27", GUICtrlRead($sleep54))
    IniWrite($Where, "CustomSleep", "CustomSleep28", GUICtrlRead($sleep56))
    IniWrite($Where, "CustomSleep", "CustomSleep29", GUICtrlRead($sleep58)) 
    
EndFunc   ;==>SaveCustomSleep

Func DefaultSleepTimes()
    
    $DefaultOption = MsgBox(3 + 32, "Default Choice", "Would you like to load factory set defaults?" & @LF & "Selecting 'No' will load 'Custom Defaults'.")
    If $DefaultOption = 6 Then
        $DS1 = IniRead($Where, 'DefaultSleep', 'DefaultSleep1', "")
        GUICtrlSetData($sleep2, $DS1)
        $DS2 = IniRead($Where, 'DefaultSleep', 'DefaultSleep2', "")
        GUICtrlSetData($sleep4, $DS2)
        $DS3 = IniRead($Where, 'DefaultSleep', 'DefaultSleep3', "")
        GUICtrlSetData($sleep6, $DS3)
        $DS4 = IniRead($Where, 'DefaultSleep', 'DefaultSleep4', "")
        GUICtrlSetData($sleep8, $DS4)
        $DS5 = IniRead($Where, 'DefaultSleep', 'DefaultSleep5', "")
        GUICtrlSetData($sleep10, $DS5)
        $DS6 = IniRead($Where, 'DefaultSleep', 'DefaultSleep6', "")
        GUICtrlSetData($sleep12, $DS6)
        $DS7 = IniRead($Where, 'DefaultSleep', 'DefaultSleep7', "")
        GUICtrlSetData($sleep14, $DS7)
        $DS8 = IniRead($Where, 'DefaultSleep', 'DefaultSleep8', "")
        GUICtrlSetData($sleep16, $DS8)
        $DS9 = IniRead($Where, 'DefaultSleep', 'DefaultSleep9', "")
        GUICtrlSetData($sleep18, $DS9)
        $DS10 = IniRead($Where, 'DefaultSleep', 'DefaultSleep10', "")
        GUICtrlSetData($sleep20, $DS10)
        $DS11 = IniRead($Where, 'DefaultSleep', 'DefaultSleep11', "")
        GUICtrlSetData($sleep22, $DS11)
        $DS12 = IniRead($Where, 'DefaultSleep', 'DefaultSleep12', "")
        GUICtrlSetData($sleep24, $DS12)
        $DS13 = IniRead($Where, 'DefaultSleep', 'DefaultSleep13', "")
        GUICtrlSetData($sleep26, $DS13)
        $DS14 = IniRead($Where, 'DefaultSleep', 'DefaultSleep14', "")
        GUICtrlSetData($sleep28, $DS14)
        $DS15 = IniRead($Where, 'DefaultSleep', 'DefaultSleep15', "")
        GUICtrlSetData($sleep30, $DS15)
        $DS16 = IniRead($Where, 'DefaultSleep', 'DefaultSleep16', "")
        GUICtrlSetData($sleep32, $DS16)
        $DS17 = IniRead($Where, 'DefaultSleep', 'DefaultSleep17', "")
        GUICtrlSetData($sleep34, $DS17)
        $DS18 = IniRead($Where, 'DefaultSleep', 'DefaultSleep18', "")
        GUICtrlSetData($sleep36, $DS18)
        $DS19 = IniRead($Where, 'DefaultSleep', 'DefaultSleep19', "")
        GUICtrlSetData($sleep38, $DS19)
        $DS20 = IniRead($Where, 'DefaultSleep', 'DefaultSleep20', "")
        GUICtrlSetData($sleep40, $DS20)
        $DS21 = IniRead($Where, 'DefaultSleep', 'DefaultSleep21', "")
        GUICtrlSetData($sleep42, $DS21)
        $DS22 = IniRead($Where, 'DefaultSleep', 'DefaultSleep22', "")
        GUICtrlSetData($sleep44, $DS22)
        $DS23 = IniRead($Where, 'DefaultSleep', 'DefaultSleep23', "")
        GUICtrlSetData($sleep46, $DS23)
        $DS24 = IniRead($Where, 'DefaultSleep', 'DefaultSleep24', "")
        GUICtrlSetData($sleep48, $DS24)
        $DS25 = IniRead($Where, 'DefaultSleep', 'DefaultSleep25', "")
        GUICtrlSetData($sleep50, $DS25)
        $DS26 = IniRead($Where, 'DefaultSleep', 'DefaultSleep26', "")
        GUICtrlSetData($sleep52, $DS26)
        $DS27 = IniRead($Where, 'DefaultSleep', 'DefaultSleep27', "")
        GUICtrlSetData($sleep54, $DS27)
        $DS28 = IniRead($Where, 'DefaultSleep', 'DefaultSleep28', "")
        GUICtrlSetData($sleep56, $DS28)
        $DS29 = IniRead($Where, 'DefaultSleep', 'DefaultSleep29', "")
        GUICtrlSetData($sleep58, $DS29)     
    EndIf
    If $DefaultOption = 7 Then
        $CS1 = IniRead($Where, 'CustomSleep', 'CustomSleep1', "")
        GUICtrlSetData($sleep2, $CS1)
        $CS2 = IniRead($Where, 'CustomSleep', 'CustomSleep2', "")
        GUICtrlSetData($sleep4, $CS2)
        $CS3 = IniRead($Where, 'CustomSleep', 'CustomSleep3', "")
        GUICtrlSetData($sleep6, $CS3)
        $CS4 = IniRead($Where, 'CustomSleep', 'CustomSleep4', "")
        GUICtrlSetData($sleep8, $CS4)
        $CS5 = IniRead($Where, 'CustomSleep', 'CustomSleep5', "")
        GUICtrlSetData($sleep10, $CS5)
        $CS6 = IniRead($Where, 'CustomSleep', 'CustomSleep6', "")
        GUICtrlSetData($sleep12, $CS6)
        $CS7 = IniRead($Where, 'CustomSleep', 'CustomSleep7', "")
        GUICtrlSetData($sleep14, $CS7)
        $CS8 = IniRead($Where, 'CustomSleep', 'CustomSleep8', "")
        GUICtrlSetData($sleep16, $CS8)
        $CS9 = IniRead($Where, 'CustomSleep', 'CustomSleep9', "")
        GUICtrlSetData($sleep18, $CS9)
        $CS10 = IniRead($Where, 'CustomSleep', 'CustomSleep10', "")
        GUICtrlSetData($sleep20, $CS10)
        $CS11 = IniRead($Where, 'CustomSleep', 'CustomSleep11', "")
        GUICtrlSetData($sleep22, $CS11)
        $CS12 = IniRead($Where, 'CustomSleep', 'CustomSleep12', "")
        GUICtrlSetData($sleep24, $CS12)
        $CS13 = IniRead($Where, 'CustomSleep', 'CustomSleep13', "")
        GUICtrlSetData($sleep26, $CS13)
        $CS14 = IniRead($Where, 'CustomSleep', 'CustomSleep14', "")
        GUICtrlSetData($sleep28, $CS14)
        $CS15 = IniRead($Where, 'CustomSleep', 'CustomSleep15', "")
        GUICtrlSetData($sleep30, $CS15)
        $CS16 = IniRead($Where, 'CustomSleep', 'CustomSleep16', "")
        GUICtrlSetData($sleep32, $CS16)
        $CS17 = IniRead($Where, 'CustomSleep', 'CustomSleep17', "")
        GUICtrlSetData($sleep34, $CS17)
        $CS18 = IniRead($Where, 'CustomSleep', 'CustomSleep18', "")
        GUICtrlSetData($sleep36, $CS18)
        $CS19 = IniRead($Where, 'CustomSleep', 'CustomSleep19', "")
        GUICtrlSetData($sleep38, $CS19)
        $CS20 = IniRead($Where, 'CustomSleep', 'CustomSleep20', "")
        GUICtrlSetData($sleep40, $CS20)
        $CS21 = IniRead($Where, 'CustomSleep', 'CustomSleep21', "")
        GUICtrlSetData($sleep42, $CS21)
        $CS22 = IniRead($Where, 'CustomSleep', 'CustomSleep22', "")
        GUICtrlSetData($sleep44, $CS22)
        $CS23 = IniRead($Where, 'CustomSleep', 'CustomSleep23', "")
        GUICtrlSetData($sleep46, $CS23)
        $CS24 = IniRead($Where, 'CustomSleep', 'CustomSleep24', "")
        GUICtrlSetData($sleep48, $CS24)
        $CS25 = IniRead($Where, 'CustomSleep', 'CustomSleep25', "")
        GUICtrlSetData($sleep50, $CS25)
        $CS26 = IniRead($Where, 'CustomSleep', 'CustomSleep26', "")
        GUICtrlSetData($sleep52, $CS26)
        $CS27 = IniRead($Where, 'CustomSleep', 'CustomSleep27', "")
        GUICtrlSetData($sleep54, $CS27)
        $CS28 = IniRead($Where, 'CustomSleep', 'CustomSleep28', "")
        GUICtrlSetData($sleep56, $CS28)
        $CS29 = IniRead($Where, 'CustomSleep', 'CustomSleep29', "")
        GUICtrlSetData($sleep58, $CS29)     
    EndIf
    If $DefaultOption = 2 Then
        ;
    EndIf
    
EndFunc   ;==>DefaultSleepTimes

Func CancelSleepTimes()
    
        $ES1 = IniRead($Where, 'Sleep', 'SleepSend1', "")
        GUICtrlSetData($sleep2, $ES1)
        $ES2 = IniRead($Where, 'Sleep', 'SleepSend2', "")
        GUICtrlSetData($sleep4, $ES2)
        $ES3 = IniRead($Where, 'Sleep', 'SleepSend3', "")
        GUICtrlSetData($sleep6, $ES3)
        $ES4 = IniRead($Where, 'Sleep', 'SleepSend4', "")
        GUICtrlSetData($sleep8, $ES4)
        $ES5 = IniRead($Where, 'Sleep', 'SleepSend5', "")
        GUICtrlSetData($sleep10, $ES5)
        $ES6 = IniRead($Where, 'Sleep', 'SleepSend6', "")
        GUICtrlSetData($sleep12, $ES6)
        $ES7 = IniRead($Where, 'Sleep', 'SleepSend7', "")
        GUICtrlSetData($sleep14, $ES7)
        $ES8 = IniRead($Where, 'Sleep', 'SleepSend8', "")
        GUICtrlSetData($sleep16, $ES8)
        $ES9 = IniRead($Where, 'Sleep', 'SleepSend9', "")
        GUICtrlSetData($sleep18, $ES9)
        $ES10 = IniRead($Where, 'Sleep', 'SleepSend10', "")
        GUICtrlSetData($sleep20, $ES10)
        $ES11 = IniRead($Where, 'Sleep', 'SleepSend11', "")
        GUICtrlSetData($sleep22, $ES11)
        $ES12 = IniRead($Where, 'Sleep', 'SleepSend12', "")
        GUICtrlSetData($sleep24, $ES12)
        $ES13 = IniRead($Where, 'Sleep', 'SleepSend13', "")
        GUICtrlSetData($sleep26, $ES13)
        $ES14 = IniRead($Where, 'Sleep', 'SleepSend14', "")
        GUICtrlSetData($sleep28, $ES14)
        $ES15 = IniRead($Where, 'Sleep', 'SleepSend15', "")
        GUICtrlSetData($sleep30, $ES15)
        $ES16 = IniRead($Where, 'Sleep', 'SleepSend16', "")
        GUICtrlSetData($sleep32, $ES16)
        $ES17 = IniRead($Where, 'Sleep', 'SleepSend17', "")
        GUICtrlSetData($sleep34, $ES17)
        $ES18 = IniRead($Where, 'Sleep', 'SleepSend18', "")
        GUICtrlSetData($sleep36, $ES18)
        $ES19 = IniRead($Where, 'Sleep', 'SleepSend19', "")
        GUICtrlSetData($sleep38, $ES19)
        $ES20 = IniRead($Where, 'Sleep', 'SleepSend20', "")
        GUICtrlSetData($sleep40, $ES20)
        $ES21 = IniRead($Where, 'Sleep', 'SleepSend21', "")
        GUICtrlSetData($sleep42, $ES21)
        $ES22 = IniRead($Where, 'Sleep', 'SleepSend22', "")
        GUICtrlSetData($sleep44, $ES22)
        $ES23 = IniRead($Where, 'Sleep', 'SleepSend23', "")
        GUICtrlSetData($sleep46, $ES23)
        $ES24 = IniRead($Where, 'Sleep', 'SleepSend24', "")
        GUICtrlSetData($sleep48, $ES24)
        $ES25 = IniRead($Where, 'Sleep', 'SleepSend25', "")
        GUICtrlSetData($sleep50, $ES25)
        $ES26 = IniRead($Where, 'Sleep', 'SleepSend26', "")
        GUICtrlSetData($sleep52, $ES26)
        $ES27 = IniRead($Where, 'Sleep', 'SleepSend27', "")
        GUICtrlSetData($sleep54, $ES27)
        $ES28 = IniRead($Where, 'Sleep', 'SleepSend28', "")
        GUICtrlSetData($sleep56, $ES28)
        $ES29 = IniRead($Where, 'Sleep', 'SleepSend29', "")
        GUICtrlSetData($sleep58, $ES29)     

EndFunc   ;==>CancelSleepTimes


;;=============================================================================================Settings Child

Func SaveSettings()
    
    IniWrite($Where, 'Settings', 'Settings1', GUICtrlRead($settings2))
    IniWrite($Where, 'Settings', 'Settings2', GUICtrlRead($settings4))
    IniWrite($Where, 'Settings', 'Settings3', GUICtrlRead($settings6))
    IniWrite($Where, 'Settings', 'Settings4', GUICtrlRead($settings8))  
    IniWrite($Where, 'Settings', 'Settings5', GUICtrlRead($settings10))
    IniWrite($Where, 'Settings', 'Settings6', GUICtrlRead($settings12))
    IniWrite($Where, 'Settings', 'Settings7', GUICtrlRead($settings14))
    IniWrite($Where, 'Settings', 'Settings8', GUICtrlRead($settings16))
    IniWrite($Where, 'Settings', 'Settings9', GUICtrlRead($settings18))
    ;===========================================================================================
    $Drive = IniRead($Where, "Settings", "Settings8", "NotFound")
    $total = DriveSpaceTotal($Drive)
    $free = DriveSpaceFree($Drive)
    $used = $total - $free
    GUICtrlSetData($progress, 100 * $used / DriveSpaceTotal($Drive))
    GUICtrlSetData($lbl_Used, Round($used / 1024, 2) & " GB used ")
    GUICtrlSetData($lbl_Free, Round($free / 1024, 2) & " GB free ")
    GUICtrlSetData($label4, $Drive)
    ;===========================================================================================
    
EndFunc   ;==>SaveSettings

Func CancelSettings()

    $ESettings1 = IniRead($Where, 'Settings', 'Settings1', "")
    GUICtrlSetData($settings2, $ESettings1)
    $ESettings2 = IniRead($Where, 'Settings', 'Settings2', "")
    GUICtrlSetData($settings4, $ESettings2)
    $ESettings3 = IniRead($Where, 'Settings', 'Settings3', "")
    GUICtrlSetData($settings6, $ESettings3)
    $ESettings4 = IniRead($Where, 'Settings', 'Settings4', "")
    GUICtrlSetData($settings8, $ESettings4)
    $ESettings5 = IniRead($Where, 'Settings', 'Settings5', "")
    GUICtrlSetData($settings10, $ESettings5)
    $ESettings6 = IniRead($Where, 'Settings', 'Settings6', "")
    GUICtrlSetData($settings12, $ESettings6)
    $ESettings7 = IniRead($Where, 'Settings', 'Settings7', "")
    GUICtrlSetData($settings14, $ESettings7)
    $ESettings8 = IniRead($Where, 'Settings', 'Settings8', "")
    GUICtrlSetData($settings16, $ESettings8)
    $ESettings9 = IniRead($Where, 'Settings', 'Settings9', "")
    GUICtrlSetData($settings18, $ESettings9)
    
EndFunc   ;==>CancelSettings

;;=============================================================================================Key Bindings Child

Func SaveKeyBindings()
    
    IniWrite($Where, 'KeyBindings', 'KeyBindings1', GUICtrlRead($keybindings2))
    IniWrite($Where, 'KeyBindings', 'KeyBindings2', GUICtrlRead($keybindings4))
    IniWrite($Where, 'KeyBindings', 'KeyBindings3', GUICtrlRead($keybindings6))
    IniWrite($Where, 'KeyBindings', 'KeyBindings4', GUICtrlRead($keybindings8))
    IniWrite($Where, 'KeyBindings', 'KeyBindings5', GUICtrlRead($keybindings10))
    IniWrite($Where, 'KeyBindings', 'KeyBindings6', GUICtrlRead($keybindings12))
    IniWrite($Where, 'KeyBindings', 'KeyBindings7', GUICtrlRead($keybindings14))
    IniWrite($Where, 'KeyBindings', 'KeyBindings8', GUICtrlRead($keybindings16))
    IniWrite($Where, 'KeyBindings', 'KeyBindings9', GUICtrlRead($keybindings18))
    IniWrite($Where, 'KeyBindings', 'KeyBindings10', GUICtrlRead($keybindings20))
    IniWrite($Where, 'KeyBindings', 'KeyBindings11', GUICtrlRead($keybindings22))
    IniWrite($Where, 'KeyBindings', 'KeyBindings12', GUICtrlRead($keybindings24))
    IniWrite($Where, 'KeyBindings', 'KeyBindings13', GUICtrlRead($keybindings26))
    IniWrite($Where, 'KeyBindings', 'KeyBindings14', GUICtrlRead($keybindings28))
    IniWrite($Where, 'KeyBindings', 'KeyBindings15', GUICtrlRead($keybindings30))
    IniWrite($Where, 'KeyBindings', 'KeyBindings16', GUICtrlRead($keybindings32))
    IniWrite($Where, 'KeyBindings', 'KeyBindings17', GUICtrlRead($keybindings34))
    IniWrite($Where, 'KeyBindings', 'KeyBindings18', GUICtrlRead($keybindings36))
    IniWrite($Where, 'KeyBindings', 'KeyBindings19', GUICtrlRead($keybindings38))
    IniWrite($Where, 'KeyBindings', 'KeyBindings20', GUICtrlRead($keybindings40))
    IniWrite($Where, 'KeyBindings', 'KeyBindings21', GUICtrlRead($keybindings42))
    IniWrite($Where, 'KeyBindings', 'KeyBindings22', GUICtrlRead($keybindings44))
    IniWrite($Where, 'KeyBindings', 'KeyBindings23', GUICtrlRead($keybindings46))
    IniWrite($Where, 'KeyBindings', 'KeyBindings24', GUICtrlRead($keybindings48))
    
EndFunc   ;==>SaveKeyBindings

Func DefaultKeyBindings()
    
    $DKB1 = IniRead($Where, 'DefaultKeyBindings', 'DefaultKeyBindings1', "")
    GUICtrlSetData($keybindings2, $DKB1)
    $DKB2 = IniRead($Where, 'DefaultKeyBindings', 'DefaultKeyBindings2', "")
    GUICtrlSetData($keybindings4, $DKB2)
    $DKB3 = IniRead($Where, 'DefaultKeyBindings', 'DefaultKeyBindings3', "")
    GUICtrlSetData($keybindings6, $DKB3)
    $DKB4 = IniRead($Where, 'DefaultKeyBindings', 'DefaultKeyBindings4', "")
    GUICtrlSetData($keybindings8, $DKB4)
    $DKB5 = IniRead($Where, 'DefaultKeyBindings', 'DefaultKeyBindings5', "")
    GUICtrlSetData($keybindings10, $DKB5)
    $DKB6 = IniRead($Where, 'DefaultKeyBindings', 'DefaultKeyBindings6', "")
    GUICtrlSetData($keybindings12, $DKB6)
    $DKB7 = IniRead($Where, 'DefaultKeyBindings', 'DefaultKeyBindings7', "")
    GUICtrlSetData($keybindings14, $DKB7)
    $DKB8 = IniRead($Where, 'DefaultKeyBindings', 'DefaultKeyBindings8', "")
    GUICtrlSetData($keybindings16, $DKB8)
    $DKB9 = IniRead($Where, 'DefaultKeyBindings', 'DefaultKeyBindings9', "")
    GUICtrlSetData($keybindings18, $DKB9)
    $DKB10 = IniRead($Where, 'DefaultKeyBindings', 'DefaultKeyBindings10', "")
    GUICtrlSetData($keybindings20, $DKB10)
    $DKB11 = IniRead($Where, 'DefaultKeyBindings', 'DefaultKeyBindings11', "")
    GUICtrlSetData($keybindings22, $DKB11)
    $DKB12 = IniRead($Where, 'DefaultKeyBindings', 'DefaultKeyBindings12', "")
    GUICtrlSetData($keybindings24, $DKB12)
    $DKB13 = IniRead($Where, 'DefaultKeyBindings', 'DefaultKeyBindings13', "")
    GUICtrlSetData($keybindings26, $DKB13)
    $DKB14 = IniRead($Where, 'DefaultKeyBindings', 'DefaultKeyBindings14', "")
    GUICtrlSetData($keybindings28, $DKB14)
    $DKB15 = IniRead($Where, 'DefaultKeyBindings', 'DefaultKeyBindings15', "")
    GUICtrlSetData($keybindings30, $DKB15)
    $DKB16 = IniRead($Where, 'DefaultKeyBindings', 'DefaultKeyBindings16', "")
    GUICtrlSetData($keybindings32, $DKB16)
    $DKB17 = IniRead($Where, 'DefaultKeyBindings', 'DefaultKeyBindings17', "")
    GUICtrlSetData($keybindings34, $DKB17)
    $DKB18 = IniRead($Where, 'DefaultKeyBindings', 'DefaultKeyBindings18', "")
    GUICtrlSetData($keybindings36, $DKB18)
    $DKB19 = IniRead($Where, 'DefaultKeyBindings', 'DefaultKeyBindings19', "")
    GUICtrlSetData($keybindings38, $DKB19)
    $DKB20 = IniRead($Where, 'DefaultKeyBindings', 'DefaultKeyBindings20', "")
    GUICtrlSetData($keybindings40, $DKB20)
    $DKB21 = IniRead($Where, 'DefaultKeyBindings', 'DefaultKeyBindings21', "")
    GUICtrlSetData($keybindings42, $DKB21)
    $DKB22 = IniRead($Where, 'DefaultKeyBindings', 'DefaultKeyBindings22', "")
    GUICtrlSetData($keybindings44, $DKB22)
    $DKB23 = IniRead($Where, 'DefaultKeyBindings', 'DefaultKeyBindings23', "")
    GUICtrlSetData($keybindings46, $DKB23)
    $DKB24 = IniRead($Where, 'DefaultKeyBindings', 'DefaultKeyBindings24', "")
    
EndFunc   ;==>DefaultKeyBindings

Func CancelKeyBindings()
    
    $EKB1 = IniRead($Where, 'KeyBindings', 'KeyBindings1', "")
    GUICtrlSetData($keybindings2, $EKB1)
    $EKB2 = IniRead($Where, 'KeyBindings', 'KeyBindings2', "")
    GUICtrlSetData($keybindings4, $EKB2)
    $EKB3 = IniRead($Where, 'KeyBindings', 'KeyBindings3', "")
    GUICtrlSetData($keybindings6, $EKB3)
    $EKB4 = IniRead($Where, 'KeyBindings', 'KeyBindings4', "")
    GUICtrlSetData($keybindings8, $EKB4)
    $EKB5 = IniRead($Where, 'KeyBindings', 'KeyBindings5', "")
    GUICtrlSetData($keybindings10, $EKB5)
    $EKB6 = IniRead($Where, 'KeyBindings', 'KeyBindings6', "")
    GUICtrlSetData($keybindings12, $EKB6)
    $EKB7 = IniRead($Where, 'KeyBindings', 'KeyBindings7', "")
    GUICtrlSetData($keybindings14, $EKB7)
    $EKB8 = IniRead($Where, 'KeyBindings', 'KeyBindings8', "")
    GUICtrlSetData($keybindings16, $EKB8)
    $EKB9 = IniRead($Where, 'KeyBindings', 'KeyBindings9', "")
    GUICtrlSetData($keybindings18, $EKB9)
    $EKB10 = IniRead($Where, 'KeyBindings', 'KeyBindings10', "")
    GUICtrlSetData($keybindings20, $EKB10)
    $EKB11 = IniRead($Where, 'KeyBindings', 'KeyBindings11', "")
    GUICtrlSetData($keybindings22, $EKB11)
    $EKB12 = IniRead($Where, 'KeyBindings', 'KeyBindings12', "")
    GUICtrlSetData($keybindings24, $EKB12)
    $EKB13 = IniRead($Where, 'KeyBindings', 'KeyBindings13', "")
    GUICtrlSetData($keybindings26, $EKB13)
    $EKB14 = IniRead($Where, 'KeyBindings', 'KeyBindings14', "")
    GUICtrlSetData($keybindings28, $EKB14)
    $EKB15 = IniRead($Where, 'KeyBindings', 'KeyBindings15', "")
    GUICtrlSetData($keybindings30, $EKB15)
    $EKB16 = IniRead($Where, 'KeyBindings', 'KeyBindings16', "")
    GUICtrlSetData($keybindings32, $EKB16)
    $EKB17 = IniRead($Where, 'KeyBindings', 'KeyBindings17', "")
    GUICtrlSetData($keybindings34, $EKB17)
    $EKB18 = IniRead($Where, 'KeyBindings', 'KeyBindings18', "")
    GUICtrlSetData($keybindings36, $EKB18)
    $EKB19 = IniRead($Where, 'KeyBindings', 'KeyBindings19', "")
    GUICtrlSetData($keybindings38, $EKB19)
    $EKB20 = IniRead($Where, 'KeyBindings', 'KeyBindings20', "")
    GUICtrlSetData($keybindings40, $EKB20)
    $EKB21 = IniRead($Where, 'KeyBindings', 'KeyBindings21', "")
    GUICtrlSetData($keybindings42, $EKB21)
    $EKB22 = IniRead($Where, 'KeyBindings', 'KeyBindings22', "")
    GUICtrlSetData($keybindings44, $EKB22)
    $EKB23 = IniRead($Where, 'KeyBindings', 'KeyBindings23', "")
    GUICtrlSetData($keybindings46, $EKB23)
    $EKB24 = IniRead($Where, 'KeyBindings', 'KeyBindings24', "")
    
EndFunc   ;==>CancelKeyBindings

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;==================
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Includes
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;==================

;Func _RunWEC($sFileName, $vWorkingDirectory = '', $vFlag = '')
;    $OptREF = Opt('RunErrorsFatal', 1)
;    Local $bError = 0
;    If $vWorkingDirectory <> '' Or $vFlag <> '' Then
;        Run($sFileName, $vWorkingDirectory, $vFlag)
;        $bError = @error
;    Else
;        Run($sFileName)
;        $bError = @error
;    EndIf
;    Opt('RunErrorsFatal', $OptREF)
;    If $bError Then Return 0
;    Return 1
;EndFunc

#include <GUIConstants.au3>
#include <file.au3>

If UBound(ProcessList("NAMx.exe")) > 2 Then
    MsgBox(64, "ERROR!", "A mixdown is already in progress." & @LF & "You must press 'Stop Mixdown' before you can continue with a new mixdown.")
    Exit
EndIf

;Opt("TrayIconDebug", 1)
Opt("TrayIconHide", 1)
$Title = "N.A.M."
$Text = "Number of tracks in multitrack to mixdown."
$INIpath = ControlCommand($Title, $Text, 12349, "GetLine", "") ;ini path
$Where = $INIpath

If not Fileexists( "NAM.ini" ) then
    MsgBox(16, "ERROR!", "NAM.ini not found! Unable to continue mixdown.")
    EnableGuiCheckboxes()
    Exit
Endif

$sleep1 = IniRead($Where, 'Sleep', 'SleepSend1', 'no')
$sleep3 = IniRead($Where, 'Sleep', 'SleepSend2', 'no')
$sleep5 = IniRead($Where, 'Sleep', 'SleepSend3', 'no')
$sleep7 = IniRead($Where, 'Sleep', 'SleepSend4', 'no')
$sleep9 = IniRead($Where, 'Sleep', 'SleepSend5', 'no')
$sleep11 = IniRead($Where, 'Sleep', 'SleepSend6', 'no')
$sleep13 = IniRead($Where, 'Sleep', 'SleepSend7', 'no')
$sleep15 = IniRead($Where, 'Sleep', 'SleepSend8', 'no')
$sleep17 = IniRead($Where, 'Sleep', 'SleepSend9', 'no')
$sleep19 = IniRead($Where, 'Sleep', 'SleepSend10', 'no')
$sleep21 = IniRead($Where, 'Sleep', 'SleepSend11', 'no')
$sleep23 = IniRead($Where, 'Sleep', 'SleepSend12', 'no')
$sleep25 = IniRead($Where, 'Sleep', 'SleepSend13', 'no')
$sleep27 = IniRead($Where, 'Sleep', 'SleepSend14', 'no')
$sleep29 = IniRead($Where, 'Sleep', 'SleepSend15', 'no')
$sleep31 = IniRead($Where, 'Sleep', 'SleepSend16', 'no')
$sleep33 = IniRead($Where, 'Sleep', 'SleepSend17', 'no')
$sleep35 = IniRead($Where, 'Sleep', 'SleepSend18', 'no')
$sleep37 = IniRead($Where, 'Sleep', 'SleepSend19', 'no')
$sleep39 = IniRead($Where, 'Sleep', 'SleepSend20', 'no')
$sleep41 = IniRead($Where, 'Sleep', 'SleepSend21', 'no')
$sleep43 = IniRead($Where, 'Sleep', 'SleepSend22', 'no')
$sleep45 = IniRead($Where, 'Sleep', 'SleepSend23', 'no')
$sleep47 = IniRead($Where, 'Sleep', 'SleepSend24', 'no')
$sleep49 = IniRead($Where, 'Sleep', 'SleepSend25', 'no')
$sleep51 = IniRead($Where, 'Sleep', 'SleepSend26', 'no')
$sleep53 = IniRead($Where, 'Sleep', 'SleepSend27', 'no')
$sleep55 = IniRead($Where, 'Sleep', 'SleepSend28', 'no')
$sleep57 = IniRead($Where, 'Sleep', 'SleepSend29', 'no')


$keybindings1 = IniRead($Where, 'KeyBindings', 'KeyBindings1', 'no');Mixer
$keybindings3 = IniRead($Where, 'KeyBindings', 'KeyBindings2', 'no');EQ
$keybindings5 = IniRead($Where, 'KeyBindings', 'KeyBindings3', 'no');Inserts
$keybindings7 = IniRead($Where, 'KeyBindings', 'KeyBindings4', 'no');Sends
$keybindings9 = IniRead($Where, 'KeyBindings', 'KeyBindings5', 'no');To top of multitrack
$keybindings11 = IniRead($Where, 'KeyBindings', 'KeyBindings6', 'no');Solo
$keybindings13 = IniRead($Where, 'KeyBindings', 'KeyBindings7', 'no');Select all on track
$keybindings15 = IniRead($Where, 'KeyBindings', 'KeyBindings8', 'no');Open editor
$keybindings17 = IniRead($Where, 'KeyBindings', 'KeyBindings9', 'no');Export audio
$keybindings19 = IniRead($Where, 'KeyBindings', 'KeyBindings10', 'no');Enter
$keybindings21 = IniRead($Where, 'KeyBindings', 'KeyBindings11', 'no');Remove track
$keybindings23 = IniRead($Where, 'KeyBindings', 'KeyBindings12', 'no');Remove unused media
$keybindings25 = IniRead($Where, 'KeyBindings', 'KeyBindings13', 'no');Empty trash
$keybindings27 = IniRead($Where, 'KeyBindings', 'KeyBindings14', 'no');Conform files
$keybindings29 = IniRead($Where, 'KeyBindings', 'KeyBindings15', 'no');Prepare archive
$keybindings31 = IniRead($Where, 'KeyBindings', 'KeyBindings16', 'no');Save
$keybindings33 = IniRead($Where, 'KeyBindings', 'KeyBindings17', 'no');Save as
$keybindings35 = IniRead($Where, 'KeyBindings', 'KeyBindings18', 'no');Zoom Full
$keybindings37 = IniRead($Where, 'KeyBindings', 'KeyBindings19', 'no');Select All
$keybindings39 = IniRead($Where, 'KeyBindings', 'KeyBindings20', 'no');Down
$keybindings41 = IniRead($Where, 'KeyBindings', 'KeyBindings21', 'no');Tab
$keybindings43 = IniRead($Where, 'KeyBindings', 'KeyBindings22', 'no');Return to start position
$keybindings45 = IniRead($Where, 'KeyBindings', 'KeyBindings23', 'no');Locators to selection
$keybindings47 = IniRead($Where, 'KeyBindings', 'KeyBindings24', 'no');Merge MIDI in loop


$settings1 = IniRead($Where, 'Settings', 'Settings1', 'no');Nuendo path
$settings3 = IniRead($Where, 'Settings', 'Settings2', 'no');2 track editor
$settings5 = IniRead($Where, 'Settings', 'Settings3', 'no');Additional application
$settings7 = IniRead($Where, 'Settings', 'Settings4', 'no');Mixdown path
$settings9 = IniRead($Where, 'Settings', 'Settings5', 'no');2 track prefix
$settings11 = IniRead($Where, 'Settings', 'Settings6', 'no');file extensions
$settings13 = IniRead($Where, 'Settings', 'Settings7', 'no');Main audio path folder
$settings15 = IniRead($Where, 'Settings', 'Settings8', 'no');Drive check
$settings17 = IniRead($Where, 'Settings', 'Settings9', 'no');Prepare options and format time


Global $CPULoad
Global $CPUSleep
AdlibEnable("CPUSleeper")
Func CPUSleeper()
    $CPULoad = ControlGetText($Title, $Text, 12379)
    If $CPULoad > 90 Then
        $CPUSleep = $sleep57
    ElseIf $CPULoad > 60 Then
        $CPUSleep = $sleep55
    Else
        $CPUSleep = 0
    EndIf
EndFunc   ;==>CPUSleeper


ControlHide($Title, $Text, 12304) ;indicator1 === Automatically set full range locators
ControlHide($Title, $Text, 12307) ;indicator2 === Set format of tracks and import options
ControlHide($Title, $Text, 12311) ;indicator3 === Remove unused media from pool
ControlHide($Title, $Text, 12313) ;indicator4 === Empty Trash
ControlHide($Title, $Text, 12315) ;indicator5 === Conform files
ControlHide($Title, $Text, 12319) ;indicator6 === Prepare archive
ControlHide($Title, $Text, 12321) ;indicator7 === Create a master 2 track
ControlHide($Title, $Text, 12323) ;indicator8 === Edit 2 track master in selected editor
ControlHide($Title, $Text, 12325) ;indicator9 === Open additional app after mixdown
ControlHide($Title, $Text, 12329) ;indicator10 === Del files
ControlHide($Title, $Text, 12331) ;indicator11 === MIDI merge in loop
ControlHide($Title, $Text, 12334) ;indicator12 === Loop count
WinActivate("Nuendo", "Project")
Sleep(500)


Func EnableGuiCheckboxes()
    
    ControlEnable($Title, $Text, 12303) ;Automatically set full range locators
    ControlEnable($Title, $Text, 12305) ;Set format of tracks and import options
    ControlEnable($Title, $Text, 12308) ;Remove original tracks
    ControlEnable($Title, $Text, 12309) ;All tracks --- precaution for remove original tracks
    ControlEnable($Title, $Text, 12310) ;Remove unused media from pool
    ControlEnable($Title, $Text, 12312) ;Empty Trash
    ControlEnable($Title, $Text, 12314) ;Conform files
    ControlEnable($Title, $Text, 12316) ;Prepare archive
    ControlEnable($Title, $Text, 12318) ;Freeze Edits
    ControlEnable($Title, $Text, 12320) ;Create a master 2 track
    ControlEnable($Title, $Text, 12322) ;Edit 2 track mixdown in selected editor
    ControlEnable($Title, $Text, 12324) ;Open additional app after mixdown
    ControlEnable($Title, $Text, 12326) ;del to recycle bin
    ControlEnable($Title, $Text, 12328) ;del from HD
    ControlEnable($Title, $Text, 12330) ;MIDI merge
    ControlEnable($Title, $Text, 12333) ;Loop input
    ControlEnable($Title, $Text, 12336) ;EQs
    ControlEnable($Title, $Text, 12337) ;Sends
    ControlEnable($Title, $Text, 12338) ;Inserts
    ControlEnable($Title, $Text, 12339) ;Bypass all
    If ControlCommand($Title, $Text, 12342, "IsChecked", "") = 1 Then
        ControlEnable($Title, $Text, 12340) ;Save       
        ControlEnable($Title, $Text, 12342) ;Save as
        ControlEnable($Title, $Text, 12343) ;Save as input
    Else
        ControlEnable($Title, $Text, 12340) ;Save
        ControlEnable($Title, $Text, 12342) ;Save as
    EndIf
    ControlEnable($Title, $Text, 12344) ;Clear checks button
    ControlEnable($Title, $Text, 12346) ;OK button
    ControlEnable($Title, $Text, 12347) ;Set as defaults button
    ControlEnable($Title, $Text, 12348) ;Cancel button
    
EndFunc   ;==>EnableGuiCheckboxes

Func MixerBypasses()
    Sleep($sleep1)
    
    Send($keybindings1) ;-N----Open mixer
    ;Sleep($sleep3)
    WinWait("Nuendo", "Mixer")
    If ControlCommand($Title, $Text, 12338, "IsChecked", "") = 1 Then
        Send($keybindings5) ;-N----Bypass inserts
        Sleep(2 + $CPUSleep)
    EndIf
    If ControlCommand($Title, $Text, 12336, "IsChecked", "") = 1 Then
        Send($keybindings3) ;-N----Bypass eqs
        Sleep(2 + $CPUSleep)
    EndIf
    If ControlCommand($Title, $Text, 12337, "IsChecked", "") = 1 Then
        Send($keybindings7) ;-N----Bypass sends
        Sleep(2 + $CPUSleep)
    EndIf
    
    Sleep(4)
    Send($keybindings1) ;-N----Close mixer
    ;Sleep($sleep3)
    WinWaitClose("Nuendo", "Mixer")
    
EndFunc   ;==>MixerBypasses

Global $Jump_CleanUp
Func JumpCleaning()

    $Jump_CleanUp = ""
    If $settings11 = "" Or ($settings9 = "" And ControlCommand($Title, $Text, 12320, "IsChecked", "") = 1 ) Then
        MsgBox(64, "Attention", "Unable to delete from HD or Recycle Bin." & @LF & @LF &  "1/  You have not set the wave extention on the settings page."& @LF & @LF & "OR" & @LF & @LF & "2/  You have not set your 2 Track Prefix on the settings page." & @LF & "This will cause your 2 Track Mixdown to be deleted.")
        $Jump_CleanUp = "JumpCleanUp"
    EndIf
    
EndFunc

If ControlCommand($Title, $Text, 12330, "IsChecked", "") = 1 Then
    MIDIMerge()
Else
    Function()
EndIf

Func MIDIMerge()
    
    If ControlCommand($Title, $Text, 12303, "IsChecked", "") = 1 Then  ;Set locator points
        ControlSetText($Title, $Text, 12301, "Setting Locator Points.")
        Send($keybindings37) ;-N----Select all
        Sleep($sleep5 + $CPUSleep)
        Send($keybindings45) ;-N----Locator Set
        ControlShow($Title, $Text, 12304)
        Sleep($sleep7 + $CPUSleep)
    Else
        $Range = MsgBox(4 + 48, "Auto Mixdown", "You have not selected the locator checkbox. Have you selected a locator range in the multitrack yet?", "30")
        If $Range = 6 Then
            ;
        EndIf
        If $Range = 7 Then
            EnableGuiCheckboxes()
            Return
        EndIf
    EndIf
    
    Sleep($sleep1)
    Send($keybindings43) ;-N----Return to start position
    
    Send($keybindings9) ;Go to top of multitrack
    Sleep($sleep47)
    
    $looping = ControlCommand($Title, $Text, 12333, "GetLine", "1") ;loop value
    For $a = 1 To $looping
        $Percent = ($a / $looping) * 100
        
        ControlSetText($Title, $Text, 12301, $a & " of " & $looping & " tracks merging MIDI.")
        
        Send($keybindings11) ;-N----Solo track
        Sleep($sleep9 + $CPUSleep)
        
        Send($keybindings13) ;-N----Selects all on particular track
        Sleep($sleep11 + $CPUSleep)
        
        Send($keybindings47) ;-N----Merge MIDI in loop
        Sleep($sleep43)
        
        Send($keybindings19)
        Sleep($sleep45)
        
        Send($keybindings11) ;-N----unsolo track
        Sleep($sleep9 + $CPUSleep)
        
        Send($keybindings39) ;move to the next track
        Sleep($sleep25)
        
    Next ;loop until number of times specified
    ProgressOff()
    ControlSetText($Title, $Text, "MIDI merging complete.")
    ControlShow($Title, $Text, 12331)
    
    EnableGuiCheckboxes()
EndFunc   ;==>MIDIMerge



;//////////////////////////////////////////////////////////////////////////////////////////////////
;////////////////////////////Begin audio mixdown Function//////////////////////////
;//////////////////////////////////////////////////////////////////////////////////////////////////
;//////////////////////////////////////////////////////////////////////////////////////////////////
;////////////////////////////Begin audio mixdown Function//////////////////////////
;//////////////////////////////////////////////////////////////////////////////////////////////////



Func Function()
    
    If ControlCommand($Title, $Text, 12303, "IsChecked", "") = 1 Then  ;Set locator points
        ControlSetText($Title, $Text, 12301, "Setting Locator Points.")
        Send($keybindings37) ;-N----Select all
        Sleep($sleep5 + $CPUSleep)
        Send($keybindings45) ;-N----Locator Set
        ControlShow($Title, $Text, 12304)
        Sleep($sleep1)
        ControlSetText($Title, $Text, 12301, "Locator Points Set.")
        Sleep($sleep7 + $CPUSleep)
    Else
        $Range = MsgBox(4 + 48, "Auto Mixdown", "You have not selected the locator checkbox. Have you selected a locator range in the multitrack yet?", "30")
        If $Range = 6 Then
            ;
        EndIf
        If $Range = 7 Then
            EnableGuiCheckboxes()
            Return
        EndIf
    EndIf
    
    Sleep($sleep1)
    Send($keybindings43) ;-N----Return to start position
    
    ;//////////////////////////////////////////////////////////////////////////////////////////////////
    ;////////////////////////////Open mixer for bypass EQ, sends, and inserts//////////////////////////
    ;//////////////////////////////////////////////////////////////////////////////////////////////////
    
    If ControlCommand($Title, $Text, 12336, "IsChecked", "") = 1 Or ControlCommand($Title, $Text, 12337, "IsChecked", "") = 1 Or ControlCommand($Title, $Text, 12338, "IsChecked", "") = 1 Then
        ControlSetText($Title, $Text, 12301, "Bypassing Mixer.")
        MixerBypasses()
    EndIf
    
    ;//////////////////////////////////////////////////////////////////////////////////////////////////
    ;///////////////////////Close mixer for bypass of  EQ, sends, and inserts//////////////////////////
    ;//////////////////////////////////////////////////////////////////////////////////////////////////
    
    
    
    ;//////////////////////////////////////////////////////////////////////////////////////////////////
    ;//////////////////////////////////Begin auto mixdown process//////////////////////////////////////
    ;//////////////////////////////////////////////////////////////////////////////////////////////////
    
    Send($keybindings9) ;Go to top of multitrack
    Sleep($sleep47)
    
    ;//////////////////////////////////Set format of mixdown begins//////////////////////////////////////
    
    If ControlCommand($Title, $Text, 12305, "IsChecked", "") = 1 Then
        ControlSetText($Title, $Text, 12301, "Setting Format And Import Preferences.")
        Send($keybindings11) ;-N----Solo track
        Sleep($sleep9 + $CPUSleep)
        Do
            Send($keybindings13) ;-N----Selects all on particular track
            Sleep($sleep11)
            
            Send($keybindings15) ;-N----Open edit view
            Sleep($sleep53)
        Until WinExists("Nuendo", "Editor")
        
        If WinExists("Nuendo", "Sample Editor") Then
            Sleep($sleep1)
            $bull = StringTrimLeft(WinGetText("Nuendo", "Sample Editor"), 15) ;Copys title of Audio track and deletes "Sample Editor:"
            Sleep($sleep1)
        EndIf
        
        If WinExists("Nuendo", "Key Editor") Then
            Sleep($sleep1)
            $bull = StringTrimLeft(WinGetText("Nuendo", "Key Editor"), 12) ;Copys title of MIDI(VST I) track and deletes "Key Editor:"
            Sleep($sleep1)
        EndIf
        
        Do
            Send($keybindings15) ;-N----Close edit view
            ;                   MsgBox(64,"Error","editor not closing in format options")
            Sleep(100)
        Until Not WinExists("Nuendo", "Editor")
        Sleep($sleep13 + $CPUSleep)
        
        Send($keybindings17) ;-N----Opens mixdown window
        WinWaitActive("Export Audio Mixdown in", "File name:")
        
        Sleep($sleep1)
        
        Send($settings7 & "\")
        
        $Split = StringSplit($bull, @LF) ;Split off LFs from copying the text of "Sample Editor"
        
        If IsArray($Split) Then
            For $i = 1 To 1
                Send($Split[$i]) ;Pastes split up track name
            Next
        EndIf
        
        $time = $settings17
        $step = 100 / $settings17
        
        ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
        $Jump_flag = ""
        ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
        
        ProgressOn("Format And Import Options", "Time to enter format/import settings.", "Please wait.", "50", "50", "16")
        For $i = 0 To 100 Step $step
            $time = $time - 1
            Sleep(1000)
            ProgressSet($i, $time & " seconds left. Please wait.")
            If $time < 11 Then Run(@ComSpec & " /c echo " & Chr(7), "", @SW_HIDE)
            
            ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
            If Not WinExists("Export Audio Mixdown in", "File name:") Then
                $Jump_flag = "Jump"
                ExitLoop
            EndIf
            ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
        Next
        ProgressSet(100, "Done", "Complete")
        Sleep(50)
        ProgressOff()
        Sleep($sleep1 + $CPUSleep)
        
        ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
        If $Jump_flag <> "Jump" Then
            Send($keybindings19) ;Enter
            WinWaitClose("Export Audio Mixdown in", "File name:")
            Sleep($sleep15 + $CPUSleep)
        EndIf
        
        If WinExists("Nuendo", "Do you want to replace") Then
            Send($keybindings19) ;Enter
            Sleep($sleep17 + $CPUSleep)
        EndIf
        
        If WinExists("Nuendo", "Continue") Then 
            Send($keybindings19) ;Enter
            Sleep($sleep1 + $CPUSleep)
        EndIf

        If WinExists("Nuendo", "Reuse") Then
            Sleep($sleep1)
            Send($keybindings19) ;Enter
            Sleep($sleep1 + $CPUSleep)
        EndIf
        
        WinWaitClose("Export Audio", "Abort")
        Sleep($sleep21 + $CPUSleep)
        
        If WinExists("Import Options", "Help") Then;Import options
            WinWaitClose("Import Options", "Help", "10")
            Send($keybindings19) ;Enter
            Sleep($sleep23 + $CPUSleep)
        EndIf
        
        Send($keybindings11) ;-N----unsolo track
        Sleep($sleep9)
        
        If ControlCommand($Title, $Text, 12308, "IsChecked", "") = 1 Then ;remove original mixed down track
            Send($keybindings21) ;-N----Remove track
            Sleep($sleep27 + $CPUSleep)
        Else
            Send($keybindings39) ;move to the next track
            Sleep($sleep25)
            
        EndIf
        ControlShow($Title, $Text, 12307)
        Sleep($sleep1)
        ControlSetText($Title, $Text, 12301, "Format And Import Preferences complete.")
        Sleep($sleep1)
    EndIf
    
    ;//////////////////////////////////Set format of mixdown ends//////////////////////////////////////
    
    
    ;//////////////////////////////////Mixdown loop begins/////////////////////////////////////////////
    
    $formatvalueset = ControlCommand($Title, $Text, 12306, "GetLine", "1") ;format value
    $looping = ControlCommand($Title, $Text, 12333, "GetLine", "1") ;loop value
    
    If $looping > 1 Then ProgressOn("Auto Mixdown Progress", "Please wait.", "Beginning Mixdown", "50", "50", "16")
    
    For $a = 1 To $looping - $formatvalueset
        $Percent = ($a / ($looping - $formatvalueset)) * 100
        
        If ControlCommand($Title, $Text, 12305, "IsChecked", "") = 1 Then
            ProgressSet($Percent, $a + 1 & " of " & $looping & " tracks mixing down.", "Progress...")
            ControlSetText($Title, $Text, 12301, $a + 1 & " of " & $looping & " tracks mixing down.")
        Else
            ProgressSet($Percent, $a & " of " & $looping & " tracks mixing down.", "Progress...")
            ControlSetText($Title, $Text, 12301, $a & " of " & $looping & " tracks mixing down.")
        EndIf
        
        Sleep($sleep49)
        Send($keybindings11) ;-N----Solo track
        Sleep($sleep9 + $CPUSleep)
        
        Do
            Send($keybindings13) ;-N----Selects all on particular track
            Sleep($sleep11)
            
            Send($keybindings15) ;-N----Open edit view
            ;   MsgBox(64,"box 1","open editor")
            Sleep($sleep53)
        Until WinExists("Nuendo", "Editor")
        
        If WinExists("Nuendo", "Sample Editor") Then
            Sleep($sleep1)
            $bull = StringTrimLeft(WinGetText("Nuendo", "Sample Editor"), 15) ;Copys title of Audio track and deletes "Sample Editor:"
            Sleep($sleep1)
        EndIf
        
        If WinExists("Nuendo", "Key Editor") Then
            Sleep($sleep1)
            $bull = StringTrimLeft(WinGetText("Nuendo", "Key Editor"), 12) ;Copys title of MIDI(VST I) track and deletes "Key Editor:"
            Sleep($sleep1)
        EndIf
        
        Do
            Send($keybindings15) ;-N----Close edit view
            ;                   MsgBox(64,"Error","editor not closing")
            Sleep(500)
        Until Not WinExists("Nuendo", "Key Editor")
        Sleep($sleep13 + $CPUSleep)
        
        Send($keybindings17) ;-N----Opens mixdown window
        WinWaitActive("Export Audio Mixdown in", "File name:")
        Sleep($sleep1)
        
        Send($settings7 & "\")
        ;       Sleep ( 1000 )
        
        $Split = StringSplit($bull, @LF) ;Split off LFs from copying the text of "Sample Editor"
        
        If IsArray($Split) Then
            For $i = 1 To 1
                Send($Split[$i]) ;Pastes split up track name
                If ControlCommand($Title, $Text, 12305, "IsChecked", "") = 1 Then
                    ProgressSet($Percent, $a + 1 & " of " & $looping & " tracks mixing down." & @LF & "Currently Track: " & $Split[$i] & @LF & "Please Wait.", "Progress...")
                    ControlSetText($Title, $Text, 12301, "Currently Mixing: " & $Split[$i])
                Else
                    ProgressSet($Percent, $a & " of " & $looping & " tracks mixing down." & @LF & "Currently Track: " & $Split[$i] & @LF & "Please Wait.", "Progress...")
                    ControlSetText($Title, $Text, 12301, "Currently Mixing: " & $Split[$i])
                EndIf
            Next
        EndIf
        
        Sleep($sleep1)
        
        Send($keybindings19) ;-N----Enter: Save---start mixdown
        WinWaitClose("Export Audio Mixdown in", "File name:")
        Sleep($sleep15)
        
        If WinExists("Nuendo", "Do you want to replace") Then
            Send($keybindings19) ;Enter
            Sleep($sleep17 + $CPUSleep)
        EndIf
        
        If WinExists("Nuendo", "Continue") Then 
            Send($keybindings19)
            Sleep($sleep1 + $CPUSleep)
        EndIf
        
        If WinExists("Nuendo", "Reuse") Then
        ;   Sleep($sleep1)
            Send($keybindings19) ;Enter
            Sleep($sleep1 + $CPUSleep)
        EndIf
        
        WinWaitClose("Export Audio", "Abort")
        Sleep($sleep21 + $CPUSleep)
        
        If WinExists("Import Options", "Help") Then;Import options
            WinWaitClose("Import Options", "Help", "10")
            Send($keybindings19) ;Enter
            Sleep($sleep23)
        EndIf
        
        Send($keybindings11) ;-N----unsolo track
        Sleep($sleep9)
        
        If ControlCommand($Title, $Text, 12308, "IsChecked", "") = 1 Then ;remove original mixed down track
            Send($keybindings21) ;-N----Remove track
            Sleep($sleep27 + $CPUSleep)
        Else
            Send($keybindings39) ;move to the next track
            Sleep($sleep25 + $CPUSleep)
        EndIf
        
    Next ;loop until number of times specified
    ProgressOff()
    ControlShow($Title, $Text, 12334) ;pic11
    Sleep($sleep1)  
    ControlSetText($Title, $Text, 12301, "Track mixing portion complete.")
    
    
    ;//////////////////////////////////Mixdown loop ends///////////////////////////////////////////////
    
    ;//////////////////////////////////////////////////////////////////////////////////////////////////
    ;//////////////////////////////////End auto mixdown process////////////////////////////////////////
    ;//////////////////////////////////////////////////////////////////////////////////////////////////
    
    
    
    ;//////////////////////////////////////////////////////////////////////////////////////////////////
    ;///////////////////Open mixer for bypass release of  EQ, sends, and inserts///////////////////////
    ;//////////////////////////////////////////////////////////////////////////////////////////////////
    
    If ControlCommand($Title, $Text, 12336, "IsChecked", "") = 1 Or ControlCommand($Title, $Text, 12337, "IsChecked", "") = 1 Or ControlCommand($Title, $Text, 12338, "IsChecked", "") = 1 Then
        ControlSetText($Title, $Text, 12301, "Releasing Mixer Bypasses.")
        MixerBypasses()
    EndIf
    
    ;///////////////////Precaution with remove original track. If that option is chosen upon mixdown of last track bypasses automatically
    ;///////////////////release, and then they are bypassed again do to the releasing mixer bypasses. This will counter that, AND
    ;///////////////////release the master fader.
    If ControlCommand($Title, $Text, 12309, "IsChecked", "") = 1 Then
        If ControlCommand($Title, $Text, 12336, "IsChecked", "") = 1 Or ControlCommand($Title, $Text, 12337, "IsChecked", "") = 1 Or ControlCommand($Title, $Text, 12338, "IsChecked", "") = 1 Then
            ControlSetText($Title, $Text, 12301, "Releasing Mixer Bypasses.")
            MixerBypasses()
        EndIf
    EndIf
    
    ;//////////////////////////////////////////////////////////////////////////////////////////////////
    ;///////////////Close mixer for bypass release of  EQ, sends, and inserts//////////////////////////
    ;//////////////////////////////////////////////////////////////////////////////////////////////////
    
    
    
    ;//////////////////////////////////////////////////////////////////////////////////////////////////
    ;////////////////////////////////Option begin exporting two track mixdown//////////////////////////
    ;//////////////////////////////////////////////////////////////////////////////////////////////////
    
    If ControlCommand($Title, $Text, 12320, "IsChecked", "") = 1 Then ;Create a master 2 track of mix
        $Jump_Export2Track = ""
        If $settings9 = "" Then
            $Jump_Export2Track = "Export2Track"
        EndIf
        
        If $Jump_Export2Track <> "Export2Track" Then    
            ControlSetText($Title, $Text, 12301, "Mixing Down 2 Track Master.")
            $MasterMixdown1 = StringTrimLeft(WinGetText(""), 14) ;Copys title of the project and cuts out "Nuendo Project "
            Sleep($sleep1)
            
            $MasterMixdown2 = StringTrimRight($MasterMixdown1, 5) ;Takes "MasterMixdown1" and cuts off ".npr"
            Sleep($sleep1)
            
            Send($keybindings17) ;-N----Opens mixdown window
            WinWaitActive("Export Audio Mixdown in", "File name:")
            Sleep($sleep1)
            
            Send($settings9) ;Paste prefix
            Send($MasterMixdown2) ;Pastes final name of track
            Sleep($sleep1)
            Send($keybindings19) ;-N----Enter: Save---start mixdown
            WinWaitClose("Export Audio Mixdown in", "File name:")
            Sleep($sleep15 + $CPUSleep)
            
            If WinExists("Nuendo", "Do you want to replace") Then
                Send($keybindings19) ;Enter
                Sleep($sleep17 + $CPUSleep)
            EndIf
            
            If WinExists("Nuendo", "Continue") Then         
                Send($keybindings19) ;Enter
                Sleep(1500 + $CPUSleep)     ;Sleep($sleep19 + $CPUSleep)
            EndIf       
            
            WinWaitClose("Export Audio", "Abort")
            Sleep($sleep21 + $CPUSleep)
            
            If WinExists("Import Options", "Help") Then;Import options
                WinWaitClose("Import Options", "Help", "10")
                Send($keybindings19) ;Enter
                Sleep($sleep23)
            EndIf
            ControlShow($Title, $Text, 12321)
            Sleep($sleep1)      
            ControlSetText($Title, $Text, 12301, "2 Track Master Mix Complete.")        
            Sleep($sleep51)
        EndIf
    EndIf
    
    ;//////////////////////////////////////////////////////////////////////////////////////////////////
    ;////////////////////////////////Option end exporting two track mixdown////////////////////////////
    ;//////////////////////////////////////////////////////////////////////////////////////////////////
    
    
    
    ;//////////////////////////////////////////////////////////////////////////////////////////////////
    ;/////////////////////////////////////Option begin clean up session////////////////////////////////
    ;//////////////////////////////////////////////////////////////////////////////////////////////////
    
    If ControlCommand($Title, $Text, 12310, "IsChecked", "") = 1 Then ;Remove unused media option
        ControlSetText($Title, $Text, 12301, "Removing Unused Media.")
        Send($keybindings23) ;-N----Remove unused media from pool to trash
        Sleep($sleep1)
        ControlShow($Title, $Text, 12311)
        Sleep($sleep1)      
        ControlSetText($Title, $Text, 12301, "Unused Media Removed.")
        Sleep($sleep29)
    EndIf
    
    
    If ControlCommand($Title, $Text, 12312, "IsChecked", "") = 1 Then ;Empty trash option
        ControlSetText($Title, $Text, 12301, "Emptying Trash.")
        Send($keybindings25) ;-N----Erase pool trash from Hard Disk
        Sleep($sleep1 + $CPUSleep)
        Send($keybindings19) ;Enter
        Sleep($sleep1)
        ControlShow($Title, $Text, 12313)
        Sleep($sleep1)      
        ControlSetText($Title, $Text, 12301, "Trash Emptied.")
        Sleep($sleep31)
    EndIf
    
    
    If ControlCommand($Title, $Text, 12314, "IsChecked", "") = 1 Then ;Conform files option
        ControlSetText($Title, $Text, 12301, "Conforming Files.")
        Send($keybindings27) ;-N----Confrom all files to the same format
        Sleep($sleep1 + $CPUSleep)
        If WinExists("Nuendo", "OK") Then
            Send($keybindings19) ;Enter
            Sleep($sleep1)
        EndIf
        WinWaitActive("Converting files", "Abort")
        WinWaitClose("Converting files", "Abort")
        Sleep($sleep1)
        ControlShow($Title, $Text, 12315)
        Sleep($sleep1)      
        ControlSetText($Title, $Text, 12301, "Files Conformed.")
        Sleep($sleep33)
    EndIf
    
    
    If ControlCommand($Title, $Text, 12316, "IsChecked", "") = 1 Then ;Prepare archive option
        ControlSetText($Title, $Text, 12301, "Preparing For Archive.")
        Sleep($sleep1 + $CPUSleep)      
        Send($keybindings29) ;-N----Move all files to current audio folder
        Sleep($sleep35 + $CPUSleep)
        $Jump_PrepareArchive = ""
        If WinExists("Nuendo", "Freeze") Then
            Sleep($sleep1)
            If ControlCommand($Title, $Text, 12318, "IsChecked", "") = 1 Then ;Freeze option
                Send($keybindings19) ;Enter
            Else
                Send($keybindings41) ;Tab
                Sleep($sleep37)
                Send($keybindings19) ;Enter
            EndIf
        EndIf
        
        Sleep(1000)
        If WinExists("Nuendo", "Proceed") Then
            Send($keybindings19)
        EndIf
        
        ;the preparing archive status window happens here
        WinWait("Nuendo", "OK") ;"Pool is ready for archive!"
        Sleep($sleep1)
        Send($keybindings19) ;Enter             
        Sleep($sleep1)
        ControlShow($Title, $Text, 12319)
        Sleep($sleep1)      
        ControlSetText($Title, $Text, 12301, "Archive prepared.")
    EndIf
    
    ;//////////////////////////////////////////////////////////////////////////////////////////////////
    ;//////////////////////////////////////Option end clean up session/////////////////////////////////
    ;//////////////////////////////////////////////////////////////////////////////////////////////////
    
    
    
    ;//////////////////////////////////////////////////////////////////////////////////////////////////
    ;//////////////////////////////////Option begin save option////////////////////////////////////////
    ;//////////////////////////////////////////////////////////////////////////////////////////////////
    
    
    ;//////////////////////////////////Option standard save option/////////////////////////////////////
    If ControlCommand($Title, $Text, 12340, "IsChecked", "") = 1 Then ;Save option
        ControlSetText($Title, $Text, 12301, "Saving.")
        Send($keybindings31) ;-N----Save
        Sleep($sleep1)      
        ControlSetText($Title, $Text, 12301, "File Saved.")
    EndIf
    
    ;//////////////////////////////////Option begin save as option//////////////////////////////////////
    If ControlCommand($Title, $Text, 12342, "IsChecked", "") = 1 Then ;Save As option
        $saveasINPT = ControlCommand($Title, $Text, 12343, "GetLine", "1")
        ControlSetText($Title, $Text, 12301, "Saving As '" & $saveasINPT & "'.")
        Sleep($sleep1)
        Send($keybindings33) ;-N----Save As
        WinWait("Save As -")
        Send($saveasINPT)
        Send($keybindings19) ;Enter
        Sleep(1000)
        If WinExists("Nuendo", "Do you want to replace") Then
            Send($keybindings19) ;Enter
        EndIf
        Sleep($sleep1)      
        ControlSetText($Title, $Text, 12301, "File Saved As '" & $saveasINPT & "'.")
    EndIf
    
    ;///////////////////////////////////////////////////////////////////////////////////////////////////
    ;//////////////////////////////////Option end save option//////////////////////////////////////////
    ;//////////////////////////////////////////////////////////////////////////////////////////////////
    
    
    
    ;////////////////////////////////////////////////////////////////////////////////////////////////////
    ;///////////////////////////////Option folder clening begins/////////////////////////////////////////
    ;////////////////////////////////////////////////////////////////////////////////////////////////////


    

    If ControlCommand($Title, $Text, 12328, "IsChecked", "") = 1 Then ;Delete all in mixdown folder from HD     
        JumpCleaning()
        If $Jump_CleanUp <> "JumpCleanUp" Then
            ControlSetText($Title, $Text, 12301, "Deleting Tracks From HD.")
            Sleep(5)
            If ControlCommand($Title, $Text, 12320, "IsChecked", "") = 1 Then
                FileMove($settings7 & "\*" & $settings9 & "*" & "." & $settings11, @ScriptDir & "\Temp\", 8 + 1)
                Sleep($sleep1)
            EndIf
            FileDelete($settings7 & "\*" & $settings11)
            Sleep(1000)
            If ControlCommand($Title, $Text, 12320, "IsChecked", "") = 1 Then           
                FileMove(@ScriptDir & "\Temp\*" & $settings9 & "*" & "." & $settings11, $settings7)
                Sleep($sleep1)
            EndIf
            ControlShow($Title, $Text, 12329)
            Sleep($sleep1)      
            ControlSetText($Title, $Text, 12301, "Tracks deleted from HD.")
        EndIf
    EndIf
    
    If ControlCommand($Title, $Text, 12326, "IsChecked", "") = 1 Then ;Delete all in mixdown folder to recycle bin
        JumpCleaning()
        If $Jump_CleanUp <> "JumpCleanUp" Then
            ControlSetText($Title, $Text, 12301, "Deleting Tracks To Recycle Bin.")
            Sleep(5)
            If ControlCommand($Title, $Text, 12320, "IsChecked", "") = 1 Then
                FileMove($settings7 & "\*" & $settings9 & "*" & "." & $settings11, @ScriptDir & "\Temp\", 8 + 1)
                Sleep($sleep1)
            EndIf
            FileRecycle($settings7 & "\*" & $settings11)
            Sleep(1000)
            If ControlCommand($Title, $Text, 12320, "IsChecked", "") = 1 Then           
                FileMove(@ScriptDir & "\Temp\*" & $settings9 & "*" & "." & $settings11, $settings7)
                Sleep($sleep1)
            EndIf
            ControlShow($Title, $Text, 12329)
            Sleep($sleep1)      
            ControlSetText($Title, $Text, 12301, "Tracks Deleted To Recycle Bin.")
        EndIf   
    EndIf

    ;////////////////////////////////////////////////////////////////////////////////////////////////////
    ;///////////////////////////////Option folder cleaning ends//////////////////////////////////////////
    ;////////////////////////////////////////////////////////////////////////////////////////////////////
    
    ;12320 = Create 2track master
    ;12322 = Edit in 2track editor
    ;12340 = Save
    ;12342 = Save As
    
    Sleep($sleep1)
    
    If ControlCommand($Title, $Text, 12320, "IsChecked", "") = 1 And _
            ControlCommand($Title, $Text, 12322, "IsChecked", "") = 1 And _
            ControlCommand($Title, $Text, 12340, "IsChecked", "") = 0 And _
            ControlCommand($Title, $Text, 12342, "IsChecked", "") = 1 Then
        MsgBox(64, "Auto Mixdown Complete", "Your mixdown is complete." & @LF & "Your Project is saved as '" & $saveasINPT & "'." & @LF & "Your 2 track will now be exported to your external editor.")
    EndIf
    
    If ControlCommand($Title, $Text, 12320, "IsChecked", "") = 1 And _
            ControlCommand($Title, $Text, 12322, "IsChecked", "") = 1 And _
            ControlCommand($Title, $Text, 12340, "IsChecked", "") = 1 And _
            ControlCommand($Title, $Text, 12342, "IsChecked", "") = 0 Then
        MsgBox(64, "Auto Mixdown Complete", "Your mixdown is complete." & @LF & "Your Project is saved under the original name." & @LF & "Your 2 track will now be exported to your external editor.")
    EndIf
    
    If ControlCommand($Title, $Text, 12320, "IsChecked", "") = 0 And _
            ControlCommand($Title, $Text, 12322, "IsChecked", "") = 0 And _
            ControlCommand($Title, $Text, 12340, "IsChecked", "") = 0 And _
            ControlCommand($Title, $Text, 12342, "IsChecked", "") = 1 Then
        MsgBox(64, "Auto Mixdown Complete", "Your mixdown is complete." & @LF & "Your Project is saved as '" & $saveasINPT & "'.")
    EndIf
    
    If ControlCommand($Title, $Text, 12320, "IsChecked", "") = 0 And _
            ControlCommand($Title, $Text, 12322, "IsChecked", "") = 0 And _
            ControlCommand($Title, $Text, 12340, "IsChecked", "") = 1 And _
            ControlCommand($Title, $Text, 12342, "IsChecked", "") = 0 Then
        MsgBox(64, "Auto Mixdown Complete", "Your mixdown is complete." & @LF & "Your Project is saved under the original name.")
    EndIf
    
    If ControlCommand($Title, $Text, 12320, "IsChecked", "") = 1 And _
            ControlCommand($Title, $Text, 12322, "IsChecked", "") = 1 And _
            ControlCommand($Title, $Text, 12340, "IsChecked", "") = 0 And _
            ControlCommand($Title, $Text, 12342, "IsChecked", "") = 0 Then
        MsgBox(64, "Auto Mixdown Complete", "Your mixdown is complete." & @LF & "(Your Project is not yet saved)" & @LF & "Your 2 track will now be exported to your external editor.")
    EndIf
    
    If ControlCommand($Title, $Text, 12320, "IsChecked", "") = 0 And _
            ControlCommand($Title, $Text, 12322, "IsChecked", "") = 0 And _
            ControlCommand($Title, $Text, 12340, "IsChecked", "") = 0 And _
            ControlCommand($Title, $Text, 12342, "IsChecked", "") = 0 Then
        MsgBox(64, "Auto Mixdown Complete", "Your mixdown is complete." & @LF & "(Your Project is not yet saved)")
    EndIf
    
    Send($keybindings35) ;-N----Zoom Full
    
    
    
    ;////////////////////////////////////////////////////////////////////////////////////////////////////
    ;///////////////////////////////Option begin open 2track editor//////////////////////////////////////
    ;////////////////////////////////////////////////////////////////////////////////////////////////////
    
    If ControlCommand($Title, $Text, 12322, "IsChecked", "") = 1 Then
        ControlSetText($Title, $Text, 12301, "Opening 2 Track Editor.")
        $program = $settings3
        $filelong = $settings7 & "\" & $settings9 & $MasterMixdown2 & "." & $settings11
        $fileshort = FileGetShortName($filelong)
        If @error Then
            $fileshort = '"' & $filelong & '"'
        EndIf
        Run($program & ' ' & $fileshort, "", @SW_MINIMIZE)
        If @error = 1 Then MsgBox(16, 'ERROR', 'You have not set the path to the 2 Track Editor.' & @LF & @LF & 'Go to settings in NAM to set the 2 Track Editor path.')            
        Sleep($sleep1)
        ControlShow($Title, $Text, 12323)
    EndIf
    
    ;////////////////////////////////////////////////////////////////////////////////////////////////////
    ;//////////////////////////////////Option end open 2track editor/////////////////////////////////////
    ;////////////////////////////////////////////////////////////////////////////////////////////////////
    
    
    
    ;////////////////////////////////////////////////////////////////////////////////////////////////////
    ;///////////////////////////////Option begin open additional app/////////////////////////////////////
    ;////////////////////////////////////////////////////////////////////////////////////////////////////
    
    If ControlCommand($Title, $Text, 12324, "IsChecked", "") = 1 Then
        ControlSetText($Title, $Text, 12301, "Opening Additional App.")
        Run($settings5, "", @SW_MINIMIZE)
        If @error = 1 Then MsgBox(16, 'ERROR', 'You have not set the path to the Additional App.' & @LF & @LF & 'Go to settings in NAM to set the Additional App path.')    
        Sleep($sleep1)
        ControlShow($Title, $Text, 12325)
    EndIf
    
    ;////////////////////////////////////////////////////////////////////////////////////////////////////
    ;///////////////////////////////Option end open additional app///////////////////////////////////////
    ;////////////////////////////////////////////////////////////////////////////////////////////////////
    
    EnableGuiCheckboxes()
    
    ControlSetText($Title, $Text, 12301, "Mixdown Complete.")
EndFunc   ;==>Function
Edited by Champak
Link to comment
Share on other sites

IMO it would be best to have used an array for all the gui handles/strings.

but seeing how it is a bit late for that:

try not to #include so much.

just copy out the things that you really need.

it will save a lot in filesize/memory usage.

My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll

Link to comment
Share on other sites

First, Nice and clean script... well done in that respect

Second, I agree with wOuter

Third, check spelling....$labelSettings1 = GUICtrlCreateLabel("Path to AApplication. *", 10, 40, 280, 20)

and duplication....

;//////////////////////////////////////////////////////////////////////////////////////////////////

;////////////////////////////Begin audio mixdown Function//////////////////////////

;//////////////////////////////////////////////////////////////////////////////////////////////////

;//////////////////////////////////////////////////////////////////////////////////////////////////

;////////////////////////////Begin audio mixdown Function//////////////////////////

;//////////////////////////////////////////////////////////////////////////////////////////////////

8)

NEWHeader1.png

Link to comment
Share on other sites

IMO it would be best to have used an array for all the gui handles/strings.

Will this save space? Advantage? I did a search and didn't really come up with something I could understand, could you give me an example?

just copy out the things that you really need.

I looked in the include folder and at the files I included. Do you mean to copy out just the function, for example, _PathSplit, and put that function at the top of my script?

Valuator, thanks. There are no spelling errors and that is purposely duplicated.

Thanks.

Link to comment
Share on other sites

I'm pretty much done, just testing things out.

I got this error message when trying to run NamX.au3 in beta 126:
C:\Examples\NamX.au3(237,55) : ERROR: ControlSetText() [built-in] called with wrong number of args.
ControlSetText($Title, $Text, "MIDI merging complete.")
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Examples\NamX.au3(980,18) : ERROR: CPUSleeper() already defined.
Func CPUSleeper()
~~~~~~~~~~~~~~~~~^
C:\Examples\NamX.au3(1008,27) : ERROR: EnableGuiCheckboxes() already defined.
Func EnableGuiCheckboxes()
~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Examples\NamX.au3(1045,21) : ERROR: MixerBypasses() already defined.
Func MixerBypasses()
~~~~~~~~~~~~~~~~~~~~^
C:\Examples\NamX.au3(1078,17) : ERROR: MIDIMerge() already defined.
Func MIDIMerge()
~~~~~~~~~~~~~~~~^
C:\Examples\NamX.au3(1130,55) : ERROR: ControlSetText() [built-in] called with wrong number of args.
ControlSetText($Title, $Text, "MIDI merging complete.")
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Examples\NamX.au3(1147,16) : ERROR: Function() already defined.
Func Function()
~~~~~~~~~~~~~~~^
C:\Examples\NamX.au3 - 7 error(s), 0 warning(s)
...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format
Link to comment
Share on other sites

Will this save space? Advantage? I did a search and didn't really come up with something I could understand, could you give me an example?

I looked in the include folder and at the files I included. Do you mean to copy out just the function, for example, _PathSplit, and put that function at the top of my script?

Valuator, thanks. There are no spelling errors and that is purposely duplicated.

Thanks.

As far as using an Array for your variables, it would have just made things a bit easier for you. Maybe a bit more readable as well. Also for later enabling and disabling of the controls it would have helped save some lines.

I generally include functions at the bottom of my scripts, but yes that is what he is talking about. If you include 10 files but only use 1 function from each file and each file has 10 functions... you are not using 90 functions that are clogging up your memory.

On your file installs I would so something along the lines of this:

If Not(FileExists($filename)) Then
    FileInstall("sourcefile.txt", $filename)
EndIf

That way you wont be constantly over writing the files.

I will further look over the code to see if I can offer any further suggestions.

JS

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

jefhal I corrected this:

C:\Examples\NamX.au3(237,55) : ERROR: ControlSetText() [built-in] called with wrong number of args.
ControlSetText($Title, $Text, "MIDI merging complete.")

And it has been updated in the first post. But, I am not getting the other errors you are reporting to me. I even copied what I have posted here and tried. So I don't know how to fix it, or what to tell you about it. Maybe someone who knows this coding stuff a little better will be able to say what is wrong....even though I'm not seeing anything wrong.

JSThePatriot, yeah, I would have put them at the bottom, I just thought they had to be at the top because the includes were at the top...good to know. I don't think I really need that file install code, because I delet the files on exit, but I'm going to use it anyway....you never know.

I'm realizing two problems I'm having.

1/ The taskmanager cpu monitor in the tray wont delete when the program exits. When the program exits, the taskmanger process closes. But if the cpu monitor is in the tray, it wont delete until the mouse passes over it.

2/ The winontop wont work. I know it's not there now, but when it was, the window would not stay on top. Unless I have the concept wrong. If I understand it, no matter what other window is active, activated or whatever, if the script has winontop, it is suppose to stay on top. The info program always stays on top, so I know there is no other program preventing my program from staying on top.

Link to comment
Share on other sites

jefhal I corrected this:

C:\Examples\NamX.au3(237,55) : ERROR: ControlSetText() [built-in] called with wrong number of args.
ControlSetText($Title, $Text, "MIDI merging complete.")

And it has been updated in the first post. But, I am not getting the other errors you are reporting to me. I even copied what I have posted here and tried. So I don't know how to fix it, or what to tell you about it. Maybe someone who knows this coding stuff a little better will be able to say what is wrong....even though I'm not seeing anything wrong.

JSThePatriot, yeah, I would have put them at the bottom, I just thought they had to be at the top because the includes were at the top...good to know. I don't think I really need that file install code, because I delet the files on exit, but I'm going to use it anyway....you never know.

I'm realizing two problems I'm having.

1/ The taskmanager cpu monitor in the tray wont delete when the program exits. When the program exits, the taskmanger process closes. But if the cpu monitor is in the tray, it wont delete until the mouse passes over it.

2/ The winontop wont work. I know it's not there now, but when it was, the window would not stay on top. Unless I have the concept wrong. If I understand it, no matter what other window is active, activated or whatever, if the script has winontop, it is suppose to stay on top. The info program always stays on top, so I know there is no other program preventing my program from staying on top.

Search for Tray Icon Refresh. Find the script from Valik. He made quite a good refresher that would get rid of those icons that just hang around.

JS

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

I found three tray icon refreshers including Valiks...none of them are working for me unless I am doing it wrong. I put them without the function wrap at the end of my autoexit function....and nothing. I put it at the end of my GUI with and without the function wrap....and nothing. How should I be using this?

Link to comment
Share on other sites

bump

Post the code you are using. I know Valik's solution should work.

JS

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...