patriciaxxx
Programmer
I need this script to output whatever my hex string is to binary file.
In this example it is a simple zip folder so the output file is zip.zip however mystring can be extremely long and will always be different.
This is my code and it doesn’t work it errors on Clng I don’t know why because I don’t really understand how it should work.
If anyone could correct my code so that it does what I need I would be very grateful.
Option Explicit
Dim mystring
mystring = "50 4B 05 06 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00"
Binary mystring, 512
Dim strSource
Dim lp, lSize
Sub Binary(strSource, lSize)
strSource = Replace(strSource, " ", "")
With CreateObject("Scripting.FileSystemObject").CreateTextFile(".\zip.zip", True)
For lp = 1 To Len(strSource) Step lSize
.WriteLine Chr(Clng("&h" & Mid(strSource, lp, lSize),lp,2))
Next
End With
End Sub
In this example it is a simple zip folder so the output file is zip.zip however mystring can be extremely long and will always be different.
This is my code and it doesn’t work it errors on Clng I don’t know why because I don’t really understand how it should work.
If anyone could correct my code so that it does what I need I would be very grateful.
Option Explicit
Dim mystring
mystring = "50 4B 05 06 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00"
Binary mystring, 512
Dim strSource
Dim lp, lSize
Sub Binary(strSource, lSize)
strSource = Replace(strSource, " ", "")
With CreateObject("Scripting.FileSystemObject").CreateTextFile(".\zip.zip", True)
For lp = 1 To Len(strSource) Step lSize
.WriteLine Chr(Clng("&h" & Mid(strSource, lp, lSize),lp,2))
Next
End With
End Sub