Pakku Posted September 6, 2006 Posted September 6, 2006 (edited) The function doesn't do his job, it will be updated as soon as possibleHi all,i wrote a little udf which allows us to convert a character string to a binary string and the other way around.i hope i can make some of you happy with this!expandcollapse popup;=============================================================================== ; ; Description: Converts a character string to a binary string ; Parameter(s): $_string - The character string to use ; Requirement(s): None ; Return Value(s): On Success - The binary string ; On Failure - It just can't fail ; Author(s): Pakku ; Note(s): ; ;=============================================================================== Func _String2Binary($_string) $_string_split = StringSplit($_string, "") $output = "" For $a = 1 to $_string_split[0] $asc = Asc($_string_split[$a]) $mod = "" For $b = 1 to 8 $mod = Mod($asc, 2) & $mod $asc = Floor($asc/2) Next $output &= $mod Next Return $output EndFunc ;=============================================================================== ; ; Description: Converts a binary string to a character string ; Parameter(s): $_string - The binary string to use ; Requirement(s): None ; Return Value(s): On Success - The character string ; On Failure - It just can't fail ; Author(s): Pakku ; Note(s): ; ;=============================================================================== Func _Binary2String($_string) $_string_split = StringSplit(StringRegExpReplace($_string, "[^:xdigit:]", ""), "") $_output = "" For $a = 1 to $_string_split[0] Step 8 $_temp = "" For $b = 0 To 7 $_temp &= $_string_split[$a+$b] Next $_chr = 0 $_temp = StringSplit($_temp, "") For $c = 1 to $_temp[0] $_chr *= 2 $_chr += Number($_temp[$c]) Next $_output &= Chr($_chr) Next Return $_output EndFuncAny response, questions, modification or what ever is welcome! Edited January 11, 2011 by Pakku How can someone use Windows without using AutoIt?That one would properly don't know how to handle a computer!My scripts:Send files over internetKind of RSS reader3Draw ProUDF: convert a character string to a binary one and backCalculate PiCommand line downloader (Youtube/Google video)Set the transparency of a window just by hitting a key!Secure your pcOther things:My filemanMy profilePM me
Moderators SmOke_N Posted September 6, 2006 Moderators Posted September 6, 2006 (edited) Any response, questions, modification or what ever is welcome!ArjanSeems to be alot like nfwu'shttp://www.autoitscript.com/forum/index.ph...mp;#entry211599 Edited September 6, 2006 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
Pakku Posted September 7, 2006 Author Posted September 7, 2006 (edited) yes you are right, but mine is shorter Edited November 16, 2010 by Pakku How can someone use Windows without using AutoIt?That one would properly don't know how to handle a computer!My scripts:Send files over internetKind of RSS reader3Draw ProUDF: convert a character string to a binary one and backCalculate PiCommand line downloader (Youtube/Google video)Set the transparency of a window just by hitting a key!Secure your pcOther things:My filemanMy profilePM me
Gnomercy Posted September 13, 2006 Posted September 13, 2006 yes you are right, but mine is shorterArjanand appears wrong. Tested your function w/the following test$var = "simple test"$ret = _String2Binary($var)ConsoleWrite("$ret - "&$ret&@CRLF)$msg = _Binary2String($ret)ConsoleWrite("$msg - "&$msg&@CRLF)-------Output-------$ret - 011100110110100101110011011011010110100101110011011100000110110101101001011100110110110001110000011011010110100101110011011001010110110001110000011011010110100101110011001000000110010101101100011100000110110101101001011100110111010000100000011001010110110001110000011011010110100101110011011001010111010000100000011001010110110001110000011011010110100101110011011100110110010101110100001000000110010101101100011100000110110101101001011100110111010001110011011001010111010000100000011001010110110001110000011011010110100101110011$msg - ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss
Pakku Posted September 14, 2006 Author Posted September 14, 2006 (edited) i see, you are right.i will update it as soon as possiblethanksSee first post Edited November 16, 2010 by Pakku How can someone use Windows without using AutoIt?That one would properly don't know how to handle a computer!My scripts:Send files over internetKind of RSS reader3Draw ProUDF: convert a character string to a binary one and backCalculate PiCommand line downloader (Youtube/Google video)Set the transparency of a window just by hitting a key!Secure your pcOther things:My filemanMy profilePM me
SxyfrG Posted June 20, 2008 Posted June 20, 2008 still not working (_Binary2String that is) Just returns an empty string :| My scripts:AppLauncherTRAY - Awesome app launcher that runs from the system tray NEW VERSION! | Run Length Encoding - VERY simple compression in pure autoit | Simple Minesweeper Game - Fun little game :)My website
Moderators SmOke_N Posted June 20, 2008 Moderators Posted June 20, 2008 still not working (_Binary2String that is)Just returns an empty string :|You're kidding right???? You brought up a 2 year old thread to say... "Still not working"... well no shit. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
SxyfrG Posted June 22, 2008 Posted June 22, 2008 Didn't realise it was a 2 year old thread >_> My scripts:AppLauncherTRAY - Awesome app launcher that runs from the system tray NEW VERSION! | Run Length Encoding - VERY simple compression in pure autoit | Simple Minesweeper Game - Fun little game :)My website
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