Sign in to follow this  
Followers 0
TheWarLords

Help me :)

13 posts in this topic

I Need Add Music in my Code

How ?

Thanks.

Share this post


Link to post
Share on other sites



That depends on what you mean by music. Have you looked at SoundPlay in the help file?

Share this post


Link to post
Share on other sites

#3 ·  Posted (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.

#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...

Edited by ApudAngelorum

Things that I've done..

Icon Resource Editor: icon resource editor 

AutoIt Piano: a piano

AutoIt Unlocker: unlocks files when you want to delete them

Colorful tooltips: a wrapper for the tool tips UDF

Rouge GoogleBot: a full screen animation

ASciTE text editor: a text editor written in autoit

Warning: Posts by this user are subject to change or may disappear without notice.

Share this post


Link to post
Share on other sites

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.

#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!

shutdown(1)

Share this post


Link to post
Share on other sites

THanks but not Work affter i Select Music

Share this post


Link to post
Share on other sites

We need code to fix to fix code.

idk make code for music

Share this post


Link to post
Share on other sites

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? :oops:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

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? :oops:

M23

yes i wen't music play in my File

Share this post


Link to post
Share on other sites

TheWarLords,

That is not clear - let us try again. :oops:

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._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

TheWarLords,

That is not clear - let us try again. :oops:

Do you want to play a .mp3, .wma or .wav music file using AutoIt?

M23

yes i wen't Try But i fail so i ask here :bye:

Share this post


Link to post
Share on other sites

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. :oops:

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. :bye:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
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
Sign in to follow this  
Followers 0