patriciaxxx
Programmer
Please if anyone is expert in VBScript can you help me as I am not.
What I need is long string turned into smaller ones of specified length with all spaces removed and my own additional string added to the beginning and end of each line.
The specified length must be allowed to be specified in this example I have chosen 11 .
The last line will be what ever is left over in this example it is 6 left over.
The string could be 300,000 characters or more or less it will always be different.
This is the string to add at front of each line
For x = 1 To 511 Step 2 : ts.Write Chr(Clng("&H" & Mid("
This is the string to add at end of each line
",x,2))) : Next
Below is as far as I can get without your help.
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.CreateTextFile(".\output.txt", True)
Dim mystring
mystring = "4D 5A 90 00 03 00 00 00 04 00 00 00 FF FF 00 00 B8 00 00 00 00 00 00 00 40”
objFile.WriteLine mid(Replace(mystring," ",""),1,11)
objFile.Close
It outputs to text file the following line
4D5A9000030
But if it worked the way I need it to the text file would be
For x = 1 To 511 Step 2 : ts.Write Chr(Clng("&H" & Mid("4D5A9000030",x,2))) : Next
For x = 1 To 511 Step 2 : ts.Write Chr(Clng("&H" & Mid("00000040000",x,2))) : Next
For x = 1 To 511 Step 2 : ts.Write Chr(Clng("&H" & Mid("00FFFF0000B",x,2))) : Next
For x = 1 To 511 Step 2 : ts.Write Chr(Clng("&H" & Mid("80000000000",x,2))) : Next
For x = 1 To 511 Step 2 : ts.Write Chr(Clng("&H" & Mid("000040",x,2))) : Next
What I need is long string turned into smaller ones of specified length with all spaces removed and my own additional string added to the beginning and end of each line.
The specified length must be allowed to be specified in this example I have chosen 11 .
The last line will be what ever is left over in this example it is 6 left over.
The string could be 300,000 characters or more or less it will always be different.
This is the string to add at front of each line
For x = 1 To 511 Step 2 : ts.Write Chr(Clng("&H" & Mid("
This is the string to add at end of each line
",x,2))) : Next
Below is as far as I can get without your help.
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.CreateTextFile(".\output.txt", True)
Dim mystring
mystring = "4D 5A 90 00 03 00 00 00 04 00 00 00 FF FF 00 00 B8 00 00 00 00 00 00 00 40”
objFile.WriteLine mid(Replace(mystring," ",""),1,11)
objFile.Close
It outputs to text file the following line
4D5A9000030
But if it worked the way I need it to the text file would be
For x = 1 To 511 Step 2 : ts.Write Chr(Clng("&H" & Mid("4D5A9000030",x,2))) : Next
For x = 1 To 511 Step 2 : ts.Write Chr(Clng("&H" & Mid("00000040000",x,2))) : Next
For x = 1 To 511 Step 2 : ts.Write Chr(Clng("&H" & Mid("00FFFF0000B",x,2))) : Next
For x = 1 To 511 Step 2 : ts.Write Chr(Clng("&H" & Mid("80000000000",x,2))) : Next
For x = 1 To 511 Step 2 : ts.Write Chr(Clng("&H" & Mid("000040",x,2))) : Next