TheWarLords Posted April 2, 2012 Share Posted April 2, 2012 I Need Add Music in my Code How ? Thanks. Link to comment Share on other sites More sharing options...
czardas Posted April 2, 2012 Share Posted April 2, 2012 That depends on what you mean by music. Have you looked at SoundPlay in the help file? operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
Skitty Posted April 2, 2012 Share Posted April 2, 2012 (edited) You can convert a wav file or MP3 (I think) and include it into a script and play it like this.You can convert the file using something like this.expandcollapse popup#region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Res_Comment=File to variable #AutoIt3Wrapper_Res_Description=Creates a variable from a given file for in script inclusion #AutoIt3Wrapper_Res_Fileversion=1.0.0.0 #AutoIt3Wrapper_Res_Fileversion_AutoIncrement=y #AutoIt3Wrapper_Res_LegalCopyright=AutoIt Community #AutoIt3Wrapper_Res_Language=1033 #AutoIt3Wrapper_Res_requestedExecutionLevel=asInvoker #AutoIt3Wrapper_AU3Check_Parameters=-d -w 3 -w 4 -w #AutoIt3Wrapper_Run_Tidy=y #AutoIt3Wrapper_Run_Obfuscator=y #Obfuscator_Parameters=/so #endregion ;**** Directives created by AutoIt3Wrapper_GUI **** FileToVariable(FileOpenDialog("Select File To Process", "", "All(*.*)"), 0, 0, 120) Func FileToVariable($File, $2file = 0, $Compress = False, $LineLen = 120) If $File = "" Then Exit If Not $2file Then Local $Variable = StringStripWS(InputBox("Varable Name", "Enter Var Name:", "Bin"), 3) If $Variable = "" Then Exit EndIf Local $Handle = FileOpen($File, 16) Local $Source = FileRead($Handle) FileClose($Handle) If $Compress Then $Source = _LZNTCompress($Source, 258) If $2file Then Local $hFile = FileSaveDialog("Select File to save as", "", "ALL(*.*)", 18) If @error Then Return 1 FileWrite($hFile, Binary($Source)) Return 1 EndIf Local $StringLen = $LineLen Local $String = String($Source) Local $Out = "Local $" & $Variable & " = '" & StringLeft($String, $StringLen - 2) & "'& _" & @CRLF $String = StringTrimLeft($String, $StringLen - 2) While StringLen($String) > $StringLen $Out &= " '" & StringLeft($String, $StringLen) & "'& _" & @CRLF $String = StringTrimLeft($String, $StringLen) WEnd If StringLen($String) <> 0 Then $Out &= " '" & $String & "'" & @CRLF ClipPut($Out) MsgBox(64, "Advisory", "The binary data was placed to clipboard, paste it with [CTRL]+[V]") Return EndFunc ;==>FileToVariable Func _LZNTCompress($vInput, $iCompressionFormatAndEngine = 2) If Not $iCompressionFormatAndEngine = 258 Then $iCompressionFormatAndEngine = 2 Local $bBinary = Binary($vInput) Local $tInput = DllStructCreate("byte[" & BinaryLen($bBinary) & "]") DllStructSetData($tInput, 1, $bBinary) Local $a_Call = DllCall("ntdll.dll", "int", "RtlGetCompressionWorkSpaceSize", _ "ushort", $iCompressionFormatAndEngine, _ "dword*", 0, _ "dword*", 0) If @error Or $a_Call[0] Then Return SetError(1, 0, "") ; error determining workspace buffer size EndIf Local $tWorkSpace = DllStructCreate("byte[" & $a_Call[2] & "]") ; workspace is needed for compression Local $tBuffer = DllStructCreate("byte[" & 16 * DllStructGetSize($tInput) & "]") ; initially oversizing buffer $a_Call = DllCall("ntdll.dll", "int", "RtlCompressBuffer", _ "ushort", $iCompressionFormatAndEngine, _ "ptr", DllStructGetPtr($tInput), _ "dword", DllStructGetSize($tInput), _ "ptr", DllStructGetPtr($tBuffer), _ "dword", DllStructGetSize($tBuffer), _ "dword", 4096, _ "dword*", 0, _ "ptr", DllStructGetPtr($tWorkSpace)) If @error Or $a_Call[0] Then Return SetError(2, 0, "") ; error compressing EndIf Local $tOutput = DllStructCreate("byte[" & $a_Call[7] & "]", DllStructGetPtr($tBuffer)) Return SetError(0, 0, DllStructGetData($tOutput, 1)) EndFunc ;==>_LZNTCompressAlthough if the file is really large, you'll get a yack stack something error or somewhere along those lines... Edited April 2, 2012 by ApudAngelorum Link to comment Share on other sites More sharing options...
Guest Posted April 2, 2012 Share Posted April 2, 2012 You can convert a wav file or MP3 (I think) and include it into a script and play it like this. You can convert the file using something like this. expandcollapse popup#region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Res_Comment=File to variable #AutoIt3Wrapper_Res_Description=Creates a variable from a given file for in script inclusion #AutoIt3Wrapper_Res_Fileversion=1.0.0.0 #AutoIt3Wrapper_Res_Fileversion_AutoIncrement=y #AutoIt3Wrapper_Res_LegalCopyright=AutoIt Community #AutoIt3Wrapper_Res_Language=1033 #AutoIt3Wrapper_Res_requestedExecutionLevel=asInvoker #AutoIt3Wrapper_AU3Check_Parameters=-d -w 3 -w 4 -w #AutoIt3Wrapper_Run_Tidy=y #AutoIt3Wrapper_Run_Obfuscator=y #Obfuscator_Parameters=/so #endregion ;**** Directives created by AutoIt3Wrapper_GUI **** FileToVariable(FileOpenDialog("Select File To Process", "", "All(*.*)"), 0, 0, 120) Func FileToVariable($File, $2file = 0, $Compress = False, $LineLen = 120) If $File = "" Then Exit If Not $2file Then Local $Variable = StringStripWS(InputBox("Varable Name", "Enter Var Name:", "Bin"), 3) If $Variable = "" Then Exit EndIf Local $Handle = FileOpen($File, 16) Local $Source = FileRead($Handle) FileClose($Handle) If $Compress Then $Source = _LZNTCompress($Source, 258) If $2file Then Local $hFile = FileSaveDialog("Select File to save as", "", "ALL(*.*)", 18) If @error Then Return 1 FileWrite($hFile, Binary($Source)) Return 1 EndIf Local $StringLen = $LineLen Local $String = String($Source) Local $Out = "Local $" & $Variable & " = '" & StringLeft($String, $StringLen - 2) & "'& _" & @CRLF $String = StringTrimLeft($String, $StringLen - 2) While StringLen($String) > $StringLen $Out &= " '" & StringLeft($String, $StringLen) & "'& _" & @CRLF $String = StringTrimLeft($String, $StringLen) WEnd If StringLen($String) <> 0 Then $Out &= " '" & $String & "'" & @CRLF ClipPut($Out) MsgBox(64, "Advisory", "The binary data was placed to clipboard, paste it with [CTRL]+[V]") Return EndFunc ;==>FileToVariable Func _LZNTCompress($vInput, $iCompressionFormatAndEngine = 2) If Not $iCompressionFormatAndEngine = 258 Then $iCompressionFormatAndEngine = 2 Local $bBinary = Binary($vInput) Local $tInput = DllStructCreate("byte[" & BinaryLen($bBinary) & "]") DllStructSetData($tInput, 1, $bBinary) Local $a_Call = DllCall("ntdll.dll", "int", "RtlGetCompressionWorkSpaceSize", _ "ushort", $iCompressionFormatAndEngine, _ "dword*", 0, _ "dword*", 0) If @error Or $a_Call[0] Then Return SetError(1, 0, "") ; error determining workspace buffer size EndIf Local $tWorkSpace = DllStructCreate("byte[" & $a_Call[2] & "]") ; workspace is needed for compression Local $tBuffer = DllStructCreate("byte[" & 16 * DllStructGetSize($tInput) & "]") ; initially oversizing buffer $a_Call = DllCall("ntdll.dll", "int", "RtlCompressBuffer", _ "ushort", $iCompressionFormatAndEngine, _ "ptr", DllStructGetPtr($tInput), _ "dword", DllStructGetSize($tInput), _ "ptr", DllStructGetPtr($tBuffer), _ "dword", DllStructGetSize($tBuffer), _ "dword", 4096, _ "dword*", 0, _ "ptr", DllStructGetPtr($tWorkSpace)) If @error Or $a_Call[0] Then Return SetError(2, 0, "") ; error compressing EndIf Local $tOutput = DllStructCreate("byte[" & $a_Call[7] & "]", DllStructGetPtr($tBuffer)) Return SetError(0, 0, DllStructGetData($tOutput, 1)) EndFunc ;==>_LZNTCompress Although if the file is really large, you'll get a yack stack something error or somewhere along those lines... OK you have basically de-compiled music! Link to comment Share on other sites More sharing options...
TheWarLords Posted April 2, 2012 Author Share Posted April 2, 2012 THanks but not Work affter i Select Music Link to comment Share on other sites More sharing options...
czardas Posted April 2, 2012 Share Posted April 2, 2012 We need code to fix to fix code. operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
TheWarLords Posted April 2, 2012 Author Share Posted April 2, 2012 We need code to fix to fix code.idk make code for music Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 2, 2012 Moderators Share Posted April 2, 2012 TheWarLords, Please explain clearly what it is you are trying to do. Do you want to play a music file in your script? Do you want to create a music file? M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
TheWarLords Posted April 3, 2012 Author Share Posted April 3, 2012 TheWarLords,Please explain clearly what it is you are trying to do. Do you want to play a music file in your script? Do you want to create a music file? M23yes i wen't music play in my File Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 3, 2012 Moderators Share Posted April 3, 2012 TheWarLords, That is not clear - let us try again. Do you want to play a .mp3, .wma or .wav music file using AutoIt? M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
TheWarLords Posted April 3, 2012 Author Share Posted April 3, 2012 TheWarLords,That is not clear - let us try again. Do you want to play a .mp3, .wma or .wav music file using AutoIt?M23yes i wen't Try But i fail so i ask here Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 3, 2012 Moderators Share Posted April 3, 2012 TheWarLords,Then look at SoundPlay (or _SoundPlay if you need more control over the sound) in the Help file. These 2 functions will play .mp3, .wma and .wav files. If you have problems, post the code you are using and we will help you solve them. If you post code, please use Code tags - put [autoit] before and [/autoit] after your posted code. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
TheWarLords Posted April 4, 2012 Author Share Posted April 4, 2012 TheWarLords, Then look at SoundPlay (or _SoundPlay if you need more control over the sound) in the Help file. These 2 functions will play .mp3, .wma and .wav files. If you have problems, post the code you are using and we will help you solve them. If you post code, please use Code tags - put before and after your posted code. M23 ok Thanks you Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now