Convert binary to file
#1
Posted 05 May 2012 - 06:23 PM
$File_Handle = FileOpen($File_Path, 0+16)
$File_Content = FileRead($File_Handle)
FileClose($File_Handle)
FileWrite("prova.txt", $File_Content)
How can I convert the new file (in this case, prova.txt) back to the original file?
Thanks for help
#2
Posted 05 May 2012 - 07:19 PM
Just open the new file for binary writing:
$File_Path = "fred4.au3" $File_Handle = FileOpen($File_Path, 0 + 16) $File_Content = FileRead($File_Handle) FileClose($File_Handle) ConsoleWrite($File_Content & @CRLF) FileWrite("prova.txt", $File_Content) $File_Handle = FileOpen("Original.txt", 2 + 16) FileWrite($File_Handle, $File_Content) FileClose($File_Handle)
But have you looked at what is in prova.txt?
M23
Toast - Small GUIs which pop out of the Systray - Marquee - Scrolling tickertape GUIs
Scrollbars - Automatically sized scrollbars with a single command - GUIFrame - Subdivide GUIs into many adjustable frames
GUIExtender - Extend and retract multiple sections within a GUI - NoFocusLines - Remove the dotted focus lines from buttons, sliders, radios and checkboxes
ChooseFileFolder - Single and multiple selections from specified path tree structure - - Notify - Small notifications on the edge of the display
RecFileListToArray - An alternative to _FileListToArray with user-defined include/exclude masks, maximum recursion level, sorting and displayed path options
GUIListViewEx - Insert, delete, move, drag and sort ListView items
#3
Posted 06 May 2012 - 07:29 AM
I have the following script:
The file "prova.txt" contains the binary version of the file "test.zip".
Now I want another script to open the file "prova.txt" and convert it back to "test.zip". It's possible to do this?
Thank you for help!
Edited by FSoft, 06 May 2012 - 07:30 AM.
#4
Posted 06 May 2012 - 11:59 AM
Nice Meeting U
Maybe This is the UDF that will Do Your Work
Link: CLICK HERE
Thumbs Up if it Helped
Regards
Phoenix XL
#5
Posted 06 May 2012 - 01:51 PM
It's possible to do everything in pure AutoIt?
Edited by FSoft, 06 May 2012 - 01:51 PM.
#6
Posted 06 May 2012 - 02:42 PM
; read binary file $hFile = FileOpen($sBinaryFile, 16) $bBinary = FileRead($hFile) FileClose($hFile) ; write hex file $hFile = FileOpen($sStringFile, 2) FileWrite($hFile, String($sBinary)) FileClose($hFile) ; -------------------------------------- ; read hex file $hFile = FileOpen($sStringFile) $sString = FileRead($hFile) FileClose($hFile) ; write new binary file $hFile = FileOpen($sNewBinaryFile, 18) FileWrite($hFile, Binary($sString)) FileClose($hFile)
#7
Posted 07 May 2012 - 08:55 AM
#8
Posted 07 May 2012 - 09:24 AM
There was a small typo. This works for me:@ProgAndy: That doesn't work. I tried with a PDF and the new file created is corrupted.
$sBinaryFile = "test.png" $sStringFile = "testbin.txt" $sNewBinaryFile = "test_out.png" ; read binary file $hFile = FileOpen($sBinaryFile, 16) $bBinary = FileRead($hFile) FileClose($hFile) ; write hex file $hFile = FileOpen($sStringFile, 2) FileWrite($hFile, String($bBinary)) FileClose($hFile) ; -------------------------------------- ; read hex file $hFile = FileOpen($sStringFile) $sString = FileRead($hFile) FileClose($hFile) ; write new binary file $hFile = FileOpen($sNewBinaryFile, 18) FileWrite($hFile, Binary($sString)) FileClose($hFile)
- Floppy likes this
#9
Posted 07 May 2012 - 11:38 AM
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users





