Networking • Automation • Occasional Podcasting
,

Autoit Soundboard

We get a copious amount of sales calls, so one of my coworkers used an online soundboard (Miss Cleo is my favorite) while speaking to the sales people.  Sooo I thought it would be funny for us to record our own and attempt to use it.  I wrote a little Autoit script to do just that.  It has 115 buttons that you can assign sound files to.  You can also change the description of the button.  When you try to change to a new sound board or exit the current sound board, it will save it.  Really simple.  You can download the exe here

or click  the link below to view the code.
soundboard

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

FileDelete(@ScriptDir & "\base.chk") ;smite base file everytime
$file = FileOpen(@ScriptDir & "\base.chk", 1) ;create base file

; Check if file opened for writing OK
If $file = -1 Then
    MsgBox(0, "Error", "Unable to open file.")
    Exit
EndIf

for $y = 1 to 224
	FileWriteLine($file, 1 & @CRLF)
Next
FileClose($file)

#Region ### START Koda GUI section ### Form=C:\Documents and Settings\gsowell\Desktop\autoit\soundboard\Form1.kxf
$Form1 = GUICreate("Sound Board", 854, 625, 193, 115)
$Button1 = GUICtrlCreateButton("1", 16, 8, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button2 = GUICtrlCreateButton("1", 121, 8, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button3 = GUICtrlCreateButton("1", 225, 8, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button4 = GUICtrlCreateButton("1", 329, 8, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button5 = GUICtrlCreateButton("1", 433, 8, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button6 = GUICtrlCreateButton("1", 537, 8, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button7 = GUICtrlCreateButton("1", 641, 8, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button8 = GUICtrlCreateButton("1", 745, 8, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button9 = GUICtrlCreateButton("1", 18, 44, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button10 = GUICtrlCreateButton("1", 123, 44, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button11 = GUICtrlCreateButton("1", 227, 44, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button12 = GUICtrlCreateButton("1", 331, 44, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button13 = GUICtrlCreateButton("1", 435, 44, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button14 = GUICtrlCreateButton("1", 539, 44, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button15 = GUICtrlCreateButton("1", 643, 44, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button16 = GUICtrlCreateButton("1", 747, 44, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button17 = GUICtrlCreateButton("1", 18, 84, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button18 = GUICtrlCreateButton("1", 123, 84, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button19 = GUICtrlCreateButton("1", 227, 84, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button20 = GUICtrlCreateButton("1", 331, 84, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button21 = GUICtrlCreateButton("1", 435, 84, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button22 = GUICtrlCreateButton("1", 539, 84, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button23 = GUICtrlCreateButton("1", 643, 84, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button24 = GUICtrlCreateButton("1", 747, 84, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button25 = GUICtrlCreateButton("1", 18, 124, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button26 = GUICtrlCreateButton("1", 123, 124, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button27 = GUICtrlCreateButton("1", 227, 124, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button28 = GUICtrlCreateButton("1", 331, 124, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button29 = GUICtrlCreateButton("1", 435, 124, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button30 = GUICtrlCreateButton("1", 539, 124, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button31 = GUICtrlCreateButton("1", 643, 124, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button32 = GUICtrlCreateButton("1", 747, 124, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button33 = GUICtrlCreateButton("1", 18, 164, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button34 = GUICtrlCreateButton("1", 123, 164, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button35 = GUICtrlCreateButton("1", 227, 164, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button36 = GUICtrlCreateButton("1", 331, 164, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button37 = GUICtrlCreateButton("1", 435, 164, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button38 = GUICtrlCreateButton("1", 539, 164, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button39 = GUICtrlCreateButton("1", 643, 164, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button40 = GUICtrlCreateButton("1", 747, 164, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button41 = GUICtrlCreateButton("1", 18, 204, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button42 = GUICtrlCreateButton("1", 123, 204, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button43 = GUICtrlCreateButton("1", 227, 204, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button44 = GUICtrlCreateButton("1", 331, 204, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button45 = GUICtrlCreateButton("1", 435, 204, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button46 = GUICtrlCreateButton("1", 539, 204, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button47 = GUICtrlCreateButton("1", 643, 204, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button48 = GUICtrlCreateButton("1", 747, 204, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button49 = GUICtrlCreateButton("1", 18, 244, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button50 = GUICtrlCreateButton("1", 123, 244, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button51 = GUICtrlCreateButton("1", 227, 244, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button52 = GUICtrlCreateButton("1", 331, 244, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button53 = GUICtrlCreateButton("1", 435, 244, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button54 = GUICtrlCreateButton("1", 539, 244, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button55 = GUICtrlCreateButton("1", 643, 244, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button56 = GUICtrlCreateButton("1", 747, 244, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button57 = GUICtrlCreateButton("1", 18, 284, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button58 = GUICtrlCreateButton("1", 123, 284, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button59 = GUICtrlCreateButton("1", 227, 284, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button60 = GUICtrlCreateButton("1", 331, 284, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button61 = GUICtrlCreateButton("1", 435, 284, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button62 = GUICtrlCreateButton("1", 539, 284, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button63 = GUICtrlCreateButton("1", 643, 284, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button64 = GUICtrlCreateButton("1", 747, 284, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button65 = GUICtrlCreateButton("1", 18, 324, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button66 = GUICtrlCreateButton("1", 123, 324, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button67 = GUICtrlCreateButton("1", 227, 324, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button68 = GUICtrlCreateButton("1", 331, 324, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button69 = GUICtrlCreateButton("1", 435, 324, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button70 = GUICtrlCreateButton("1", 539, 324, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button71 = GUICtrlCreateButton("1", 643, 324, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button72 = GUICtrlCreateButton("1", 747, 324, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button73 = GUICtrlCreateButton("1", 18, 364, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button74 = GUICtrlCreateButton("1", 123, 364, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button75 = GUICtrlCreateButton("1", 227, 364, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button76 = GUICtrlCreateButton("1", 331, 364, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button77 = GUICtrlCreateButton("1", 435, 364, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button78 = GUICtrlCreateButton("1", 539, 364, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button79 = GUICtrlCreateButton("1", 643, 364, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button80 = GUICtrlCreateButton("1", 747, 364, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button81 = GUICtrlCreateButton("1", 18, 404, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button82 = GUICtrlCreateButton("1", 123, 404, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button83 = GUICtrlCreateButton("1", 227, 404, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button84 = GUICtrlCreateButton("1", 331, 404, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button85 = GUICtrlCreateButton("1", 435, 404, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button86 = GUICtrlCreateButton("1", 539, 404, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button87 = GUICtrlCreateButton("1", 643, 404, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button88 = GUICtrlCreateButton("1", 747, 404, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button89 = GUICtrlCreateButton("1", 18, 444, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button90 = GUICtrlCreateButton("1", 123, 444, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button91 = GUICtrlCreateButton("1", 227, 444, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button92 = GUICtrlCreateButton("1", 331, 444, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button93 = GUICtrlCreateButton("1", 435, 444, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button94 = GUICtrlCreateButton("1", 539, 444, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button95 = GUICtrlCreateButton("1", 643, 444, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button96 = GUICtrlCreateButton("1", 747, 444, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button97 = GUICtrlCreateButton("1", 18, 484, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button98 = GUICtrlCreateButton("1", 123, 484, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button99 = GUICtrlCreateButton("1", 227, 484, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button100 = GUICtrlCreateButton("1", 331, 484, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button101 = GUICtrlCreateButton("1", 435, 484, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button102 = GUICtrlCreateButton("1", 539, 484, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button103 = GUICtrlCreateButton("1", 643, 484, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button104 = GUICtrlCreateButton("1", 747, 484, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button105 = GUICtrlCreateButton("1", 18, 524, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button106 = GUICtrlCreateButton("1", 123, 524, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button107 = GUICtrlCreateButton("1", 227, 524, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button108 = GUICtrlCreateButton("1", 331, 524, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button109 = GUICtrlCreateButton("1", 435, 524, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button110 = GUICtrlCreateButton("1", 539, 524, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button111 = GUICtrlCreateButton("1", 643, 524, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button112 = GUICtrlCreateButton("1", 747, 524, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button113 = GUICtrlCreateButton("Edit Button", 122, 580, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button114 = GUICtrlCreateButton("New SoundBoard", 226, 580, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$Button115 = GUICtrlCreateButton("Open SoundBoard", 330, 580, 89, 25, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
$ButtNum = 0 ;button number
$Edit = 0 ; whether edit has been clicked

$fileLocation = @ScriptDir & "\base.chk" ; set base file location
$aConfigFile = _openConfig() ; load in base file

While 1
	$nMsg = GUIGetMsg()
	Switch $nMsg
		Case $GUI_EVENT_CLOSE ; look for close and check if they want to save the soundboard
			if StringInStr($fileLocation , "\base.chk") > 0 Then
				$saveFile = InputBox("Save file or loose settings", "If you don't choose a name to save this as, your settings will be erased!! " & @CRLF & "Give a file name for the config file.  It will be stored in the script dir")
				if @error == 1 Then
					Exit
				Else
					FileCopy($fileLocation, @ScriptDir & "\" & $saveFile & ".chk")
					Exit
				EndIf
			Else
				Exit
			EndIf
Case $Button1 ;check for buttons
			$ButtNum = 1 ;set button #
			if $Edit = 1 then ; if edit has been clicked edit
				_editButton()
			Else ;play sound
				_playSound()
			EndIf
Case $Button2
			$ButtNum = 2
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button3
			$ButtNum = 3
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button4
			$ButtNum = 4
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button5
			$ButtNum = 5
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button6
			$ButtNum = 6
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button7
			$ButtNum = 7
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button8
			$ButtNum = 8
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button9
			$ButtNum = 9
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button10
			$ButtNum = 10
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button11
			$ButtNum = 11
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button12
			$ButtNum = 12
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button13
			$ButtNum = 13
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button14
			$ButtNum = 14
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button15
			$ButtNum = 15
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button16
			$ButtNum = 16
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button17
			$ButtNum = 17
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button18
			$ButtNum = 18
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button19
			$ButtNum = 19
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button20
			$ButtNum = 20
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button21
			$ButtNum = 21
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button22
			$ButtNum = 22
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button23
			$ButtNum = 23
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button24
			$ButtNum = 24
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button25
			$ButtNum = 25
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button26
			$ButtNum = 26
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button27
			$ButtNum = 27
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button28
			$ButtNum = 28
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button29
			$ButtNum = 29
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button30
			$ButtNum = 30
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button31
			$ButtNum = 31
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button32
			$ButtNum = 32
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button33
			$ButtNum = 33
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button34
			$ButtNum = 34
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button35
			$ButtNum = 35
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button36
			$ButtNum = 36
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button37
			$ButtNum = 37
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button38
			$ButtNum = 38
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button39
			$ButtNum = 39
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button40
			$ButtNum = 40
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button41
			$ButtNum = 41
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button42
			$ButtNum = 42
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button43
			$ButtNum = 43
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button44
			$ButtNum = 44
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button45
			$ButtNum = 45
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button46
			$ButtNum = 46
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button47
			$ButtNum = 47
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button48
			$ButtNum = 48
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button49
			$ButtNum = 49
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button50
			$ButtNum = 50
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button51
			$ButtNum = 51
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button52
			$ButtNum = 52
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button53
			$ButtNum = 53
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button54
			$ButtNum = 54
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button55
			$ButtNum = 55
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button56
			$ButtNum = 56
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button57
			$ButtNum = 57
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button58
			$ButtNum = 58
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button59
			$ButtNum = 59
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button60
			$ButtNum = 60
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button61
			$ButtNum = 61
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button62
			$ButtNum = 62
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button63
			$ButtNum = 63
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button64
			$ButtNum = 64
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button65
			$ButtNum = 65
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button66
			$ButtNum = 66
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button67
			$ButtNum = 67
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button68
			$ButtNum = 68
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button69
			$ButtNum = 69
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button70
			$ButtNum = 70
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button71
			$ButtNum = 71
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button72
			$ButtNum = 72
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button73
			$ButtNum = 73
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button74
			$ButtNum = 74
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button75
			$ButtNum = 75
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button76
			$ButtNum = 76
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button77
			$ButtNum = 77
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button78
			$ButtNum = 78
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button79
			$ButtNum = 79
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button80
			$ButtNum = 80
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button81
			$ButtNum = 81
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button82
			$ButtNum = 82
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button83
			$ButtNum = 83
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button84
			$ButtNum = 84
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button85
			$ButtNum = 85
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button86
			$ButtNum = 86
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button87
			$ButtNum = 87
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button88
			$ButtNum = 88
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button89
			$ButtNum = 89
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button90
			$ButtNum = 90
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button91
			$ButtNum = 91
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button92
			$ButtNum = 92
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button93
			$ButtNum = 93
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button94
			$ButtNum = 94
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button95
			$ButtNum = 95
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button96
			$ButtNum = 96
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button97
			$ButtNum = 97
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button98
			$ButtNum = 98
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button99
			$ButtNum = 99
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button100
			$ButtNum = 100
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button101
			$ButtNum = 101
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button102
			$ButtNum = 102
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button103
			$ButtNum = 103
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button104
			$ButtNum = 104
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button105
			$ButtNum = 105
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button106
			$ButtNum = 106
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button107
			$ButtNum = 107
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button108
			$ButtNum = 108
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button109
			$ButtNum = 109
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button110
			$ButtNum = 110
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button111
			$ButtNum = 111
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf
Case $Button112
			$ButtNum = 112
			if $Edit = 1 then
				_editButton()
			Else
				_playSound()
			EndIf

		Case $Button114 ; new soundboard button, check if save then restart program
			if StringInStr($fileLocation , "\base.chk") > 0 Then
				$saveFile = InputBox("Save file or loose settings", "If you don't choose a name to save this as, your settings will be erased!! " & @CRLF & "Give a file name for the config file.  It will be stored in the script dir")
				if @error == 1 Then
					Run(@ScriptDir & "\soundboard.exe")
					Exit
				Else
					FileCopy($fileLocation, @ScriptDir & "\" & $saveFile & ".chk")
				EndIf
			Else
				Run(@ScriptDir & "\soundboard.exe")
				Exit
			EndIf

		Case $Button113 ;edit butotn
			$Edit = 1 ;set edit variable

		Case $Button115 ;open soundboard button
			$fileLocation = FileOpenDialog("Choose Config File", @ScriptDir, "Sound Boards(*.chk)")
			$aConfigFile = _openConfig()
	EndSwitch
WEnd

Func _editButton ()
$Edit = 0 ; get caption and file path
$caption = InputBox("Description", "What should the button description be?", $aConfigFile[$ButtNum + 2])
$newFile = FileOpenDialog("Choose Sound File", @ScriptDir, "Sound File(*.wav;*.mp3)")
if FileExists($newFile) Then ; if real file, then save the file and reset text
	$aConfigFile[$ButtNum] = $caption
	$aConfigFile[$ButtNum + 112] = $newFile
	;MsgBox(0,$ButtNum, $newFile)
	_FileWriteFromArray($fileLocation,$aConfigFile, 1)
	_GUICtrlButton_SetText($ButtNum + 2, $caption);$button & $
EndIf
EndFunc

func _playSound ()
	;SoundPlay(@WindowsDir & "\media\tada.wav",1)
	if FileExists($aConfigFile[$ButtNum + 112]) Then
		;playit
		SoundPlay($aConfigFile[$ButtNum + 112],1)
	EndIf
EndFunc

Func _openConfig()
	;read in config file and then set descriptions on buttons
	Dim $aConfigFile
	If Not _FileReadToArray($fileLocation,$aConfigFile) Then
	MsgBox(4096,"Error", " Error reading log to Array     error:" & @error)
	Exit
	EndIf
	For $x = 1 to 112 ;$aConfigFile[0]
		;starts at 3
		_GUICtrlButton_SetText($x + 2, $aConfigFile[$x]);$button & $x
	Next
	Return $aConfigFile
EndFunc

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *