Alexxander Posted March 31, 2014 Share Posted March 31, 2014 hi all im using an app on Android called tasker it have a binary read feature i can read any file to binary and save the output to a text file here is an example the sound file file and the binary read of it http://ge.tt/43Xr1OV1?c my question is how can i remake the file from the binary to file using autoit ? binary.txt Link to comment Share on other sites More sharing options...
Solution UEZ Posted March 31, 2014 Solution Share Posted March 31, 2014 (edited) Try this: Global $sB64 = StringReplace((FileRead(@ScriptDir & "\binary.txt")), @LF, "") Global $hFile = FileOpen(@ScriptDir & "\binary.ogg", 18) FileWrite($hFile, _WinAPI_Base64Decode($sB64)) FileClose($hFile) Func _WinAPI_Base64Decode($sB64String) Local $aCrypt = DllCall("Crypt32.dll", "bool", "CryptStringToBinaryA", "str", $sB64String, "dword", 0, "dword", 1, "ptr", 0, "dword*", 0, "ptr", 0, "ptr", 0) If @error Or Not $aCrypt[0] Then Return SetError(1, 0, "") Local $bBuffer = DllStructCreate("byte[" & $aCrypt[5] & "]") $aCrypt = DllCall("Crypt32.dll", "bool", "CryptStringToBinaryA", "str", $sB64String, "dword", 0, "dword", 1, "struct*", $bBuffer, "dword*", $aCrypt[5], "ptr", 0, "ptr", 0) If @error Or Not $aCrypt[0] Then Return SetError(2, 0, "") Return DllStructGetData($bBuffer, 1) EndFunc ;==>_WinAPI_Base64Decode Br, UEZ Edited March 31, 2014 by UEZ Alexxander 1 Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
Alexxander Posted March 31, 2014 Author Share Posted March 31, 2014 (edited) It worked ! thank you UEZ you are awesome ! Edited March 31, 2014 by Alexxander 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