Jump to content

Help me :)


Recommended Posts

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
Link to comment
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!
Link to comment
Share on other sites

  • Moderators

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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 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

 

Link to comment
Share on other sites

  • Moderators

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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 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

 

Link to comment
Share on other sites

  • Moderators

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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 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

 

Link to comment
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
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...