Steve26 Posted January 6, 2011 Share Posted January 6, 2011 (edited) Hello, I'm currently trying to convert an image to HEX or OCTET but am having some problems. I'm just using _StringToHex(FileRead(@scriptDir & "pathtofile")) Is this the best way to go about it, or is there another option I may have? Thank you. Edited January 6, 2011 by Steve26 Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted January 6, 2011 Share Posted January 6, 2011 (edited) Why would you read a file as text when it is not text in it? Think about that. Edited January 6, 2011 by AdmiralAlkex .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
CoolBreeze Posted January 6, 2011 Share Posted January 6, 2011 Try this: Link to comment Share on other sites More sharing options...
MvGulik Posted January 7, 2011 Share Posted January 7, 2011 (edited) Congratulations, this is the most retarded thing I have read this year.Lets hope your [not] going to think the same about that text at the end of this year. Legend: - [] = optional. --- --- --- Steve26: Forget about fileread() to get the image data inside a png-image-file. Png images data is usually compressed. Dig into the help documentation for the GDI+ UFD. (and a forum search, with user UEZ tagged, is probably a good idea to.) (and take a short detour to checkout FileRead(), or better FileOpen(), while your inside the help file.) Edited January 7, 2011 by MvGulik "Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions.""The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014) "Believing what you know ain't so" ... Knock Knock ... Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted January 7, 2011 Share Posted January 7, 2011 Congratulations, this is the most retarded thing I have read this year.I forgive you. Having a mom and dad that are actually brother and sister makes braindead babies. .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
UEZ Posted January 7, 2011 Share Posted January 7, 2011 (edited) Try this: ; ============================================================================================================================ ; Purpose : Converts any file to HEX binary string ; Author : Ward / UEZ ; ============================================================================================================================ Local $VarName = StringStripWS(InputBox("Convert to Binary String", "Select a name for the variable." & @CRLF & @CRLF & "$ will automatically added to the beginning of the variable!:", "BinaryString"), 3) If $VarName = "" Then Exit Local $FileName = FileOpenDialog("Open a file", @ScriptDir, "DLL file (*.*)") If $FileName = "" Then Exit Local $Handle = FileOpen($FileName, 16) Local $BinaryString = FileRead($Handle) FileClose($Handle) Local $LineLen = 1024 Local $DllString = String($BinaryString) Local $Script = "Func " & $VarName & "()" & @CRLF & @TAB & "Local _" & @CRLF & @TAB & "$" & $VarName & " = '" & StringLeft($DllString, $LineLen) & "'" & @CRLF $DllString = StringTrimLeft($DllString, $LineLen) While StringLen($DllString) > $LineLen $Script &= " $" & $VarName & " &= '" & StringLeft($DllString, $LineLen) & "'" & @CRLF $DllString = StringTrimLeft($DllString, $LineLen) WEnd If StringLen($DllString) <> 0 Then $Script &= " $" & $VarName & " &= '" & $DllString & "'" & @CRLF $Script &= @TAB & "Return Binary($" & $VarName & ")" & @CRLF & "EndFunc" ;~ ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $Script = ' & $Script & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console ClipPut($Script) MsgBox(64, "Convert to Binary String", "The result is in the clipboard, you can paste it to your script.") Br, UEZ Edited January 7, 2011 by UEZ 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...
Developers Jos Posted January 7, 2011 Developers Share Posted January 7, 2011 Congratulations, this is the most retarded thing I have read this year.Better start toning down a little... You have been reporting threads like your on a mission and now also publicly start personal attacks? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. 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