Decoding function

A

anime

Here is some decoding function,

Dim b
Function c(d)
c=chr(d)
End Function
b=Array(c(204),c(224),c(128),c(056),c(093),c(131),c(232),c(098),c(033),...c(000
),"")

Can someone explain this function and purpose of each line before decimal
coded ASCII.
Also, what need be changed if change Ascii encoding method to HEX encoding?
(like this 71 77 74 72 79 72 20 74 75 74 6e 6d 6e 6d 2c 72 75 72 75 69 72 75
72 75 20 34 32 34 32 ..)
 

My Computer

T

Tom Lavedas

On May 17, 12:31 pm, "anime" <[email protected]> wrote:

> Here is some decoding function,
>
> Dim b
> Function c(d)
> c=chr(d)
> End Function
> b=Array(c(204),c(224),c(128),c(056),c(093),c(131),c(232),c(098),c(033),....c(000
>  ),"")
>
> Can someone explain this function and purpose of each line before decimal
> coded ASCII.
> Also, what need be changed if change Ascii encoding method to HEX encoding?
> (like this 71 77 74 72 79 72 20 74 75 74 6e 6d 6e 6d 2c 72 75 72 75 69 7275
> 72 75 20 34 32 34 32 ..)
The function is merely a wrapper that in effect changes the name of
the intrinsic CHR() function to the letter C. Otherwise it does
NOTHING.

To convert it to use HEX strings as input, it could be something like
this ...

Function c(d)
c = chr("&H" & d)
End Function

However, I wouldn't use the next line to construct an array. Rather,
I would just create an input array from a string and cycle through
that array to create the output. It makes it far easier to code the
input, something like this ...

s = "71 77 74 72 79 72 20 74 75 74 6e 6d 6e 6d 2c 72 75 72 75 69 72 75
72 75 20 34 " _
& "32 34 32"

for each code in split(s)
t = t & "," & c(code)
next
b=split(Mid(t,2), ",")

The Mid() part removes an artifact comma from the head of the output
string.

The loop could just as easily be added to the function to return the
desired string (or array) ...

Dim b
Function decode(d)
Dim code, t
for each code in split(d)
t = t & "," & chr("&H" & CStr(d))
next
decode = split(Mid(t,2), ",")
End Function

b = decode("71 77 74 72 79 72 20 74 75 74 6e 6d 6e 6d 2c " _
& "72 75 72 75 69 72 75 72 75 20 34 32 34 32")

wsh.echo join(b, ",")
_____________________
Tom Lavedas
 

My Computer

C

Ceder

"Tom Lavedas" <[email protected]> wrote in message
news:[email protected]
On May 17, 12:31 pm, "anime" <[email protected]> wrote:

> Here is some decoding function,
>
> Dim b
> Function c(d)
> c=chr(d)
> End Function
>
b=Array(c(204),c(224),c(128),c(056),c(093),c(131),c(232),c(098),c(033),...c(
000

> ),"")
>
> Can someone explain this function and purpose of each line before decimal
> coded ASCII.
> Also, what need be changed if change Ascii encoding method to HEX
encoding?

> (like this 71 77 74 72 79 72 20 74 75 74 6e 6d 6e 6d 2c 72 75 72 75 69 72
75

> 72 75 20 34 32 34 32 ..)
The function is merely a wrapper that in effect changes the name of
the intrinsic CHR() function to the letter C. Otherwise it does
NOTHING.

To convert it to use HEX strings as input, it could be something like
this ...

Function c(d)
c = chr("&H" & d)
End Function

However, I wouldn't use the next line to construct an array. Rather,
I would just create an input array from a string and cycle through
that array to create the output. It makes it far easier to code the
input, something like this ...

s = "71 77 74 72 79 72 20 74 75 74 6e 6d 6e 6d 2c 72 75 72 75 69 72 75
72 75 20 34 " _
& "32 34 32"

for each code in split(s)
t = t & "," & c(code)
next
b=split(Mid(t,2), ",")

The Mid() part removes an artifact comma from the head of the output
string.

The loop could just as easily be added to the function to return the
desired string (or array) ...

Dim b
Function decode(d)
Dim code, t
for each code in split(d)
t = t & "," & chr("&H" & CStr(d))
next
decode = split(Mid(t,2), ",")
End Function

b = decode("71 77 74 72 79 72 20 74 75 74 6e 6d 6e 6d 2c " _
& "72 75 72 75 69 72 75 72 75 20 34 32 34 32")

wsh.echo join(b, ",")
_____________________
Tom Lavedas

--------

a bit more detailed code snippet here:

Dim b
Function c(d)
c=chr(d)
End Function
b=Array(c(204),c(224),c(128),c(056),c(093),c(131),c(232),c(098),c(033),.....
...omitted..........c(000),c(000 ),"")
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile("audio.wav", 2, True)
For i = 0 To 67593
f.write(b(i))
Next
f.close()
..... .......
......

This parts recovers encrypted audio file (67593 bytes size). How to modify
if use % char as separator (%71%77%65%72%74%79%20%63%76%62%6E% ...6D%6D) ?
 

My Computer

A

anime

"Tom Lavedas" <[email protected]> wrote in message
news:[email protected]
On May 17, 12:31 pm, "anime" <[email protected]> wrote:

> Here is some decoding function,
>
> Dim b
> Function c(d)
> c=chr(d)
> End Function
>
b=Array(c(204),c(224),c(128),c(056),c(093),c(131),c(232),c(098),c(033),...c(
000

> ),"")
>
> Can someone explain this function and purpose of each line before decimal
> coded ASCII.
> Also, what need be changed if change Ascii encoding method to HEX
encoding?

> (like this 71 77 74 72 79 72 20 74 75 74 6e 6d 6e 6d 2c 72 75 72 75 69 72
75

> 72 75 20 34 32 34 32 ..)
The function is merely a wrapper that in effect changes the name of
the intrinsic CHR() function to the letter C. Otherwise it does
NOTHING.

To convert it to use HEX strings as input, it could be something like
this ...

Function c(d)
c = chr("&H" & d)
End Function

However, I wouldn't use the next line to construct an array. Rather,
I would just create an input array from a string and cycle through
that array to create the output. It makes it far easier to code the
input, something like this ...

s = "71 77 74 72 79 72 20 74 75 74 6e 6d 6e 6d 2c 72 75 72 75 69 72 75
72 75 20 34 " _
& "32 34 32"

for each code in split(s)
t = t & "," & c(code)
next
b=split(Mid(t,2), ",")

The Mid() part removes an artifact comma from the head of the output
string.

The loop could just as easily be added to the function to return the
desired string (or array) ...

Dim b
Function decode(d)
Dim code, t
for each code in split(d)
t = t & "," & chr("&H" & CStr(d))
next
decode = split(Mid(t,2), ",")
End Function

b = decode("71 77 74 72 79 72 20 74 75 74 6e 6d 6e 6d 2c " _
& "72 75 72 75 69 72 75 72 75 20 34 32 34 32")

wsh.echo join(b, ",")
_____________________
Tom Lavedas

----------


a bit more detailed code snippet here:

Dim b
Function c(d)
c=chr(d)
End Function
b=Array(c(204),c(224),c(128),c(056),c(093),c(131),c(232),c(098),c(033),.....
...omitted..........c(000),c(000 ),"")
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile("audio.wav", 2, True)
For i = 0 To 67593
f.write(b(i))
Next
f.close()
..... .......
......

This parts recovers encrypted audio file (67593 bytes size). How to modify
if use % char as separator (%71%77%65%72%74%79%20%63%76%62%6E% ...6D%6D) ?
 

My Computer

T

Tom Lavedas

On May 17, 7:39 pm, "anime" <[email protected]> wrote:
{snip}

>
> a bit more detailed code snippet here:
>
> Dim b
> Function c(d)
> c=chr(d)
> End Function
> b=Array(c(204),c(224),c(128),c(056),c(093),c(131),c(232),c(098),c(033),......
> ..omitted..........c(000),c(000 ),"")
> Set fso = CreateObject("Scripting.FileSystemObject")
> Set f = fso.OpenTextFile("audio.wav", 2, True)
> For i = 0 To 67593
> f.write(b(i))
> Next
> f.close()
> .... .......
> .....
>
> This parts recovers encrypted audio file (67593 bytes size). How to modify
> if use % char as separator (%71%77%65%72%74%79%20%63%76%62%6E% ...6D%6D) ?
Let me see if I understand correctly. You have a string that contains
67,594 hex values in the %DD format that you want to write to a WAV
file? Is that right?

Actually, there is an intrinsic VBS function that translates that kind
of a string directly - the unescape() function. In such a case, the
solution might be as simple as ...

s = "%71%77%65%72%74%79%20%63%76%62%6E% ...6D%6D"
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile("audio.wav", 2, True)
f.write unescape(s)
f.close()

I say *might be* as this is attempting to create a binary file, which
can cause the FSO write method some heartburn. Another way is to make
use of the ADO binary stream to write the output instead, but I don't
have a handy example of that. Plus, if done exactly as I show it, it
should work to write binary data.
_____________________
Tom Lavedas
 

My Computer

A

anime

"Tom Lavedas" <[email protected]> wrote in message
news:[email protected]
On May 17, 7:39 pm, "anime" <[email protected]> wrote:
{snip}

>
> a bit more detailed code snippet here:
>
> Dim b
> Function c(d)
> c=chr(d)
> End Function
> b=Array(c(204),c(224),c(128),c(056),c(093),c(131),c(232),c(098),c(033),.....
> ..omitted..........c(000),c(000 ),"")
> Set fso = CreateObject("Scripting.FileSystemObject")
> Set f = fso.OpenTextFile("audio.wav", 2, True)
> For i = 0 To 67593
> f.write(b(i))
> Next
> f.close()
> .... .......
> .....
>
> This parts recovers encrypted audio file (67593 bytes size). How to modify
> if use % char as separator (%71%77%65%72%74%79%20%63%76%62%6E% ...6D%6D) ?
Let me see if I understand correctly. You have a string that contains
67,594 hex values in the %DD format that you want to write to a WAV
file? Is that right?

Actually, there is an intrinsic VBS function that translates that kind
of a string directly - the unescape() function. In such a case, the
solution might be as simple as ...

s = "%71%77%65%72%74%79%20%63%76%62%6E% ...6D%6D"
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile("audio.wav", 2, True)
f.write unescape(s)
f.close()

I say *might be* as this is attempting to create a binary file, which
can cause the FSO write method some heartburn. Another way is to make
use of the ADO binary stream to write the output instead, but I don't
have a handy example of that. Plus, if done exactly as I show it, it
should work to write binary data.
_____________________
Tom Lavedas

-----------

67594 bytes is file size. I will be converted into hex format, then this
script need recover it, i.e. to write to a binary WAV file.
Can it be with specifying target file size?
For i = 0 To 67593

Some converters gives a different hexadecimal string format representing,
without separator ("717765727479206300000076626E.......000000"), or "\"
separator. What in this case?
-------
anime
 

My Computer

T

Tom Lavedas

On May 18, 10:18 am, "anime" <[email protected]> wrote:

> "Tom Lavedas" <[email protected]> wrote in message
>
> news:[email protected]
> On May 17, 7:39 pm, "anime" <[email protected]> wrote:
> {snip}
>
>
>
>
>

> > a bit more detailed code snippet here:
>

> > Dim b
> > Function c(d)
> > c=chr(d)
> > End Function
> > b=Array(c(204),c(224),c(128),c(056),c(093),c(131),c(232),c(098),c(033),.....
> > ..omitted..........c(000),c(000 ),"")
> > Set fso = CreateObject("Scripting.FileSystemObject")
> > Set f = fso.OpenTextFile("audio.wav", 2, True)
> > For i = 0 To 67593
> > f.write(b(i))
> > Next
> > f.close()
> > .... .......
> > .....
>

> > This parts recovers encrypted audio file (67593 bytes size). How to modify
> > if use % char as separator (%71%77%65%72%74%79%20%63%76%62%6E% ...6D%6D) ?
>
> Let me see if I understand correctly.  You have a string that contains
> 67,594 hex values in the %DD format that you want to write to a WAV
> file?  Is that right?
>
> Actually, there is an intrinsic VBS function that translates that kind
> of a string directly - the unescape() function.  In such a case, the
> solution might be as simple as ...
>
> s = "%71%77%65%72%74%79%20%63%76%62%6E% ...6D%6D"
> Set fso = CreateObject("Scripting.FileSystemObject")
> Set f = fso.OpenTextFile("audio.wav", 2, True)
> f.write unescape(s)
> f.close()
>
> I say *might be* as this is attempting to create a binary file, which
> can cause the FSO write method some heartburn.  Another way is to make
> use of the ADO binary stream to write the output instead, but I don't
> have a handy example of that.  Plus, if done exactly as I show it, it
> should work to write binary data.
> _____________________
> Tom Lavedas
>
> -----------
>
> 67594 bytes is file size. I will be converted into hex format, then this
> script need recover it, i.e. to write to a binary WAV file.
> Can it be with specifying target file size?
> For i = 0 To 67593
>
> Some converters gives a different hexadecimal string format representing,
> without separator  ("717765727479206300000076626E.......000000"), or "\"
> separator. What in this case?
> -------
> anime
If you keep changing the rules, there's no way to answer. You will
need to figure it out yourself.

I'll give it one more try and then you're on your own.

s = "717765727479206376626E6D6D" for example
s = "%71%77%65%72%74%79%20%63%76%62%6E%6D%6D" ' or this
s = "\71\77\65\72\74\79\20\63\76\62\6E\6D\6D" ' or this
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile("audio.wav", 2, True)
f.write decode(s)
f.close()

Function decode(s)
Dim t1, t2, i
d = Asc(Ucase(left(s, 1)))
if d < Asc("0") OR d > Asc("F") then
t1 = replace(s, Chr(d), "")
else
t1 = s
end if
for i = 1 to len(t1) step 2
t2 = t2 & chr("&H" & Mid(t1, i, 2))
next
decode = t2

end function

This should work for any length of string with any delimiter (or
none). The delimiter cannot be any of the digits from 0 to 9 or A to
F and each character must be defined by a two digit hex number. Other
than that, it should work with any input string.
_____________________
Tom Lavedas
 

My Computer

A

anime

"Tom Lavedas" <[email protected]> wrote in message
news:[email protected]
On May 18, 10:18 am, "anime" <[email protected]> wrote:

> "Tom Lavedas" <[email protected]> wrote in message
>
> news:[email protected]
> On May 17, 7:39 pm, "anime" <[email protected]> wrote:
> {snip}
>
>
>
>
>

> > a bit more detailed code snippet here:
>

> > Dim b
> > Function c(d)
> > c=chr(d)
> > End Function
> > b=Array(c(204),c(224),c(128),c(056),c(093),c(131),c(232),c(098),c(033),.....
> > ..omitted..........c(000),c(000 ),"")
> > Set fso = CreateObject("Scripting.FileSystemObject")
> > Set f = fso.OpenTextFile("audio.wav", 2, True)
> > For i = 0 To 67593
> > f.write(b(i))
> > Next
> > f.close()
> > .... .......
> > .....
>

> > This parts recovers encrypted audio file (67593 bytes size). How to
> > modify
> > if use % char as separator (%71%77%65%72%74%79%20%63%76%62%6E% ...6D%6D)
> > ?
>
> Let me see if I understand correctly. You have a string that contains
> 67,594 hex values in the %DD format that you want to write to a WAV
> file? Is that right?
>
> Actually, there is an intrinsic VBS function that translates that kind
> of a string directly - the unescape() function. In such a case, the
> solution might be as simple as ...
>
> s = "%71%77%65%72%74%79%20%63%76%62%6E% ...6D%6D"
> Set fso = CreateObject("Scripting.FileSystemObject")
> Set f = fso.OpenTextFile("audio.wav", 2, True)
> f.write unescape(s)
> f.close()
>
> I say *might be* as this is attempting to create a binary file, which
> can cause the FSO write method some heartburn. Another way is to make
> use of the ADO binary stream to write the output instead, but I don't
> have a handy example of that. Plus, if done exactly as I show it, it
> should work to write binary data.
> _____________________
> Tom Lavedas
>
> -----------
>
> 67594 bytes is file size. I will be converted into hex format, then this
> script need recover it, i.e. to write to a binary WAV file.
> Can it be with specifying target file size?
> For i = 0 To 67593
>
> Some converters gives a different hexadecimal string format representing,
> without separator ("717765727479206300000076626E.......000000"), or "\"
> separator. What in this case?
> -------
> anime
If you keep changing the rules, there's no way to answer. You will
need to figure it out yourself.

I'll give it one more try and then you're on your own.

s = "717765727479206376626E6D6D" for example
s = "%71%77%65%72%74%79%20%63%76%62%6E%6D%6D" ' or this
s = "\71\77\65\72\74\79\20\63\76\62\6E\6D\6D" ' or this
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile("audio.wav", 2, True)
f.write decode(s)
f.close()

Function decode(s)
Dim t1, t2, i
d = Asc(Ucase(left(s, 1)))
if d < Asc("0") OR d > Asc("F") then
t1 = replace(s, Chr(d), "")
else
t1 = s
end if
for i = 1 to len(t1) step 2
t2 = t2 & chr("&H" & Mid(t1, i, 2))
next
decode = t2

end function

This should work for any length of string with any delimiter (or
none). The delimiter cannot be any of the digits from 0 to 9 or A to
F and each character must be defined by a two digit hex number. Other
than that, it should work with any input string.
_____________________
Tom Lavedas
----------------

Thank you for input. I want modify decoding a little just for HEX encoding
with no delimiter.


Function decode(s)
Dim t1, t2, i
d = Asc(Ucase(left(s, 1)))
if d < Asc("0") OR d > Asc("F") then
t1 = replace(s, Chr(d), "")
else
t1 = s
end if
for i = 1 to len(t1) step 2
t2 = t2 & chr("&H" & Mid(t1, i, 2))
next
decode = t2
end function

s = "717765727479206376626E....6D6D"
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile("audio.wav", 2, True)
For i = 0 To 67593
f.write decode(s)
f.close()
Set WshShell = WScript.CreateObject("WScript.Shell")
.... ....
.... .....

Thanks.
 

My Computer

T

Tom Lavedas

On May 19, 7:08 am, "anime" <[email protected]> wrote:

> "Tom Lavedas" <[email protected]> wrote in message
>
> news:[email protected]
> On May 18, 10:18 am, "anime" <[email protected]> wrote:
>
>
>

> > "Tom Lavedas" <[email protected]> wrote in message
>

> >news:[email protected]
> > On May 17, 7:39 pm, "anime" <[email protected]> wrote:
> > {snip}
>

> > > a bit more detailed code snippet here:
>

> > > Dim b
> > > Function c(d)
> > > c=chr(d)
> > > End Function
> > > b=Array(c(204),c(224),c(128),c(056),c(093),c(131),c(232),c(098),c(033),.....
> > > ..omitted..........c(000),c(000 ),"")
> > > Set fso = CreateObject("Scripting.FileSystemObject")
> > > Set f = fso.OpenTextFile("audio.wav", 2, True)
> > > For i = 0 To 67593
> > > f.write(b(i))
> > > Next
> > > f.close()
> > > .... .......
> > > .....
>

> > > This parts recovers encrypted audio file (67593 bytes size). How to
> > > modify
> > > if use % char as separator (%71%77%65%72%74%79%20%63%76%62%6E% ...6D%6D)
> > > ?
>

> > Let me see if I understand correctly. You have a string that contains
> > 67,594 hex values in the %DD format that you want to write to a WAV
> > file? Is that right?
>

> > Actually, there is an intrinsic VBS function that translates that kind
> > of a string directly - the unescape() function. In such a case, the
> > solution might be as simple as ...
>

> > s = "%71%77%65%72%74%79%20%63%76%62%6E% ...6D%6D"
> > Set fso = CreateObject("Scripting.FileSystemObject")
> > Set f = fso.OpenTextFile("audio.wav", 2, True)
> > f.write unescape(s)
> > f.close()
>

> > I say *might be* as this is attempting to create a binary file, which
> > can cause the FSO write method some heartburn. Another way is to make
> > use of the ADO binary stream to write the output instead, but I don't
> > have a handy example of that. Plus, if done exactly as I show it, it
> > should work to write binary data.
> > _____________________
> > Tom Lavedas
>

> > -----------
>

> > 67594 bytes is file size. I will be converted into hex format, then this
> > script need recover it, i.e. to write to a binary WAV file.
> > Can it be with specifying target file size?
> > For i = 0 To 67593
>

> > Some converters gives a different hexadecimal string format representing,
> > without separator ("717765727479206300000076626E.......000000"), or "\"
> > separator. What in this case?
> > -------
> > anime
>
> If you keep changing the rules, there's no way to answer.  You will
> need to figure it out yourself.
>
> I'll give it one more try and then you're on your own.
>
> s = "717765727479206376626E6D6D"  for example
> s = "%71%77%65%72%74%79%20%63%76%62%6E%6D%6D" ' or this
> s = "\71\77\65\72\74\79\20\63\76\62\6E\6D\6D" ' or this
> Set fso = CreateObject("Scripting.FileSystemObject")
> Set f = fso.OpenTextFile("audio.wav", 2, True)
> f.write decode(s)
> f.close()
>
> Function decode(s)
> Dim t1, t2, i
>   d = Asc(Ucase(left(s, 1)))
>   if d < Asc("0") OR d > Asc("F") then
>     t1 = replace(s, Chr(d), "")
>   else
>     t1 = s
>   end if
>   for i = 1 to len(t1) step 2
>     t2 = t2 & chr("&H" & Mid(t1, i, 2))
>   next
>   decode = t2
>
> end function
>
> This should work for any length of string with any delimiter (or
> none).  The delimiter cannot be any of the digits from 0 to 9 or A to
> F and each character must be defined by a two digit hex number.  Other
> than that, it should work with any input string.
> _____________________
> Tom Lavedas
> ----------------
>
> Thank you for input. I want modify decoding a little just for HEX encoding
> with no delimiter.
>
> Function decode(s)
> Dim t1, t2, i
>   d = Asc(Ucase(left(s, 1)))
>   if d < Asc("0") OR d > Asc("F") then
>     t1 = replace(s, Chr(d), "")
>   else
>     t1 = s
>   end if
>   for i = 1 to len(t1) step 2
>     t2 = t2 & chr("&H" & Mid(t1, i, 2))
>   next
>   decode = t2
> end function
>
> s = "717765727479206376626E....6D6D"
> Set fso = CreateObject("Scripting.FileSystemObject")
> Set f = fso.OpenTextFile("audio.wav", 2, True)
> For i = 0 To 67593
> f.write decode(s)
> f.close()
> Set WshShell = WScript.CreateObject("WScript.Shell")
> ...  ....
> ... .....
>
> Thanks.
Function decode(s)
Dim t, i
for i = 1 to len(s) step 2
t = t & chr("&H" & Mid(s, i, 2))
next
decode = t
end function

s = "717765727479206376626E....6D6D"
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile("audio.wav", 2, True)
f.write decode(s)
f.close()

I suggest you get the downloadable WSH documentation and start using
it. Also, the Script Center Example library.

WSH 5.6 documentation download (URL all one line)
http://www.microsoft.com/downloads/details.aspx?FamilyId=01592C48-207D-4BE1-8A76-1C4099D7BBB9&displaylang=en

TechNet Script Center Sample Scripts (URL all one line)
http://www.microsoft.com/downloads/details.aspx?FamilyID=b4cb2678-dafb-4e30-b2da-b8814fe2da5a

_____________________
Tom Lavedas
 

My Computer

A

anime

"Tom Lavedas" <[email protected]> wrote in message
news:[email protected]
On May 19, 7:08 am, "anime" <[email protected]> wrote:

> "Tom Lavedas" <[email protected]> wrote in message
>
> news:[email protected]
> On May 18, 10:18 am, "anime" <[email protected]> wrote:
>
>
>

> > "Tom Lavedas" <[email protected]> wrote in message
>

> >news:[email protected]
> > On May 17, 7:39 pm, "anime" <[email protected]> wrote:
> > {snip}
>

> > > a bit more detailed code snippet here:
>

> > > Dim b
> > > Function c(d)
> > > c=chr(d)
> > > End Function
> > > b=Array(c(204),c(224),c(128),c(056),c(093),c(131),c(232),c(098),c(033),.....
> > > ..omitted..........c(000),c(000 ),"")
> > > Set fso = CreateObject("Scripting.FileSystemObject")
> > > Set f = fso.OpenTextFile("audio.wav", 2, True)
> > > For i = 0 To 67593
> > > f.write(b(i))
> > > Next
> > > f.close()
> > > .... .......
> > > .....
>

> > > This parts recovers encrypted audio file (67593 bytes size). How to
> > > modify
> > > if use % char as separator (%71%77%65%72%74%79%20%63%76%62%6E%
> > > ...6D%6D)
> > > ?
>

> > Let me see if I understand correctly. You have a string that contains
> > 67,594 hex values in the %DD format that you want to write to a WAV
> > file? Is that right?
>

> > Actually, there is an intrinsic VBS function that translates that kind
> > of a string directly - the unescape() function. In such a case, the
> > solution might be as simple as ...
>

> > s = "%71%77%65%72%74%79%20%63%76%62%6E% ...6D%6D"
> > Set fso = CreateObject("Scripting.FileSystemObject")
> > Set f = fso.OpenTextFile("audio.wav", 2, True)
> > f.write unescape(s)
> > f.close()
>

> > I say *might be* as this is attempting to create a binary file, which
> > can cause the FSO write method some heartburn. Another way is to make
> > use of the ADO binary stream to write the output instead, but I don't
> > have a handy example of that. Plus, if done exactly as I show it, it
> > should work to write binary data.
> > _____________________
> > Tom Lavedas
>

> > -----------
>

> > 67594 bytes is file size. I will be converted into hex format, then this
> > script need recover it, i.e. to write to a binary WAV file.
> > Can it be with specifying target file size?
> > For i = 0 To 67593
>

> > Some converters gives a different hexadecimal string format
> > representing,
> > without separator ("717765727479206300000076626E.......000000"), or "\"
> > separator. What in this case?
> > -------
> > anime
>
> If you keep changing the rules, there's no way to answer. You will
> need to figure it out yourself.
>
> I'll give it one more try and then you're on your own.
>
> s = "717765727479206376626E6D6D" for example
> s = "%71%77%65%72%74%79%20%63%76%62%6E%6D%6D" ' or this
> s = "\71\77\65\72\74\79\20\63\76\62\6E\6D\6D" ' or this
> Set fso = CreateObject("Scripting.FileSystemObject")
> Set f = fso.OpenTextFile("audio.wav", 2, True)
> f.write decode(s)
> f.close()
>
> Function decode(s)
> Dim t1, t2, i
> d = Asc(Ucase(left(s, 1)))
> if d < Asc("0") OR d > Asc("F") then
> t1 = replace(s, Chr(d), "")
> else
> t1 = s
> end if
> for i = 1 to len(t1) step 2
> t2 = t2 & chr("&H" & Mid(t1, i, 2))
> next
> decode = t2
>
> end function
>
> This should work for any length of string with any delimiter (or
> none). The delimiter cannot be any of the digits from 0 to 9 or A to
> F and each character must be defined by a two digit hex number. Other
> than that, it should work with any input string.
> _____________________
> Tom Lavedas
> ----------------
>
> Thank you for input. I want modify decoding a little just for HEX encoding
> with no delimiter.
>
> Function decode(s)
> Dim t1, t2, i
> d = Asc(Ucase(left(s, 1)))
> if d < Asc("0") OR d > Asc("F") then
> t1 = replace(s, Chr(d), "")
> else
> t1 = s
> end if
> for i = 1 to len(t1) step 2
> t2 = t2 & chr("&H" & Mid(t1, i, 2))
> next
> decode = t2
> end function
>
> s = "717765727479206376626E....6D6D"
> Set fso = CreateObject("Scripting.FileSystemObject")
> Set f = fso.OpenTextFile("audio.wav", 2, True)
> For i = 0 To 67593
> f.write decode(s)
> f.close()
> Set WshShell = WScript.CreateObject("WScript.Shell")
> ... ....
> ... .....
>
> Thanks.
Function decode(s)
Dim t, i
for i = 1 to len(s) step 2
t = t & chr("&H" & Mid(s, i, 2))
next
decode = t
end function

s = "717765727479206376626E....6D6D"
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile("audio.wav", 2, True)
f.write decode(s)
f.close()

I suggest you get the downloadable WSH documentation and start using
it. Also, the Script Center Example library.

WSH 5.6 documentation download (URL all one line)
http://www.microsoft.com/downloads/details.aspx?FamilyId=01592C48-207D-4BE1-8A76-1C4099D7BBB9&displaylang=en

TechNet Script Center Sample Scripts (URL all one line)
http://www.microsoft.com/downloads/details.aspx?FamilyID=b4cb2678-dafb-4e30-b2da-b8814fe2da5a

_____________________
Tom Lavedas
------------------

Thank you for the help, Tom. Looks, Vbscript not supported anymore on Vista
and Windows 7?

anime
 

My Computer

T

Tom Lavedas

On May 19, 9:06 am, "anime" <[email protected]> wrote:

> "Tom Lavedas" <[email protected]> wrote in message
>
> news:[email protected]
> On May 19, 7:08 am, "anime" <[email protected]> wrote:
>
>
>

> > "Tom Lavedas" <[email protected]> wrote in message
>

> >news:[email protected]
> > On May 18, 10:18 am, "anime" <[email protected]> wrote:
>

> > > "Tom Lavedas" <[email protected]> wrote in message
>

> > >news:[email protected]
> > > On May 17, 7:39 pm, "anime" <[email protected]> wrote:
> > > {snip}
>

> > > > a bit more detailed code snippet here:
>

> > > > Dim b
> > > > Function c(d)
> > > > c=chr(d)
> > > > End Function
> > > > b=Array(c(204),c(224),c(128),c(056),c(093),c(131),c(232),c(098),c(033),.....
> > > > ..omitted..........c(000),c(000 ),"")
> > > > Set fso = CreateObject("Scripting.FileSystemObject")
> > > > Set f = fso.OpenTextFile("audio.wav", 2, True)
> > > > For i = 0 To 67593
> > > > f.write(b(i))
> > > > Next
> > > > f.close()
> > > > .... .......
> > > > .....
>

> > > > This parts recovers encrypted audio file (67593 bytes size). How to
> > > > modify
> > > > if use % char as separator (%71%77%65%72%74%79%20%63%76%62%6E%
> > > > ...6D%6D)
> > > > ?
>

> > > Let me see if I understand correctly. You have a string that contains
> > > 67,594 hex values in the %DD format that you want to write to a WAV
> > > file? Is that right?
>

> > > Actually, there is an intrinsic VBS function that translates that kind
> > > of a string directly - the unescape() function. In such a case, the
> > > solution might be as simple as ...
>

> > > s = "%71%77%65%72%74%79%20%63%76%62%6E% ...6D%6D"
> > > Set fso = CreateObject("Scripting.FileSystemObject")
> > > Set f = fso.OpenTextFile("audio.wav", 2, True)
> > > f.write unescape(s)
> > > f.close()
>

> > > I say *might be* as this is attempting to create a binary file, which
> > > can cause the FSO write method some heartburn. Another way is to make
> > > use of the ADO binary stream to write the output instead, but I don't
> > > have a handy example of that. Plus, if done exactly as I show it, it
> > > should work to write binary data.
> > > _____________________
> > > Tom Lavedas
>
>

> > > 67594 bytes is file size. I will be converted into hex format, then this
> > > script need recover it, i.e. to write to a binary WAV file.
> > > Can it be with specifying target file size?
> > > For i = 0 To 67593
>

> > > Some converters gives a different hexadecimal string format
> > > representing,
> > > without separator ("717765727479206300000076626E.......000000"), or "\"
> > > separator. What in this case?
> > > -------
> > > anime
>

> > If you keep changing the rules, there's no way to answer. You will
> > need to figure it out yourself.
>

> > I'll give it one more try and then you're on your own.
>

> > s = "717765727479206376626E6D6D" for example
> > s = "%71%77%65%72%74%79%20%63%76%62%6E%6D%6D" ' or this
> > s = "\71\77\65\72\74\79\20\63\76\62\6E\6D\6D" ' or this
> > Set fso = CreateObject("Scripting.FileSystemObject")
> > Set f = fso.OpenTextFile("audio.wav", 2, True)
> > f.write decode(s)
> > f.close()
>

> > Function decode(s)
> > Dim t1, t2, i
> > d = Asc(Ucase(left(s, 1)))
> > if d < Asc("0") OR d > Asc("F") then
> > t1 = replace(s, Chr(d), "")
> > else
> > t1 = s
> > end if
> > for i = 1 to len(t1) step 2
> > t2 = t2 & chr("&H" & Mid(t1, i, 2))
> > next
> > decode = t2
>

> > end function
>

> > This should work for any length of string with any delimiter (or
> > none). The delimiter cannot be any of the digits from 0 to 9 or A to
> > F and each character must be defined by a two digit hex number. Other
> > than that, it should work with any input string.
> > _____________________
> > Tom Lavedas
> > ----------------
>

> > Thank you for input. I want modify decoding a little just for HEX encoding
> > with no delimiter.
>

> > Function decode(s)
> > Dim t1, t2, i
> > d = Asc(Ucase(left(s, 1)))
> > if d < Asc("0") OR d > Asc("F") then
> > t1 = replace(s, Chr(d), "")
> > else
> > t1 = s
> > end if
> > for i = 1 to len(t1) step 2
> > t2 = t2 & chr("&H" & Mid(t1, i, 2))
> > next
> > decode = t2
> > end function
>

> > s = "717765727479206376626E....6D6D"
> > Set fso = CreateObject("Scripting.FileSystemObject")
> > Set f = fso.OpenTextFile("audio.wav", 2, True)
> > For i = 0 To 67593
> > f.write decode(s)
> > f.close()
> > Set WshShell = WScript.CreateObject("WScript.Shell")
> > ... ....
> > ... .....
>

> > Thanks.
>
> Function decode(s)
> Dim t, i
>   for i = 1 to len(s) step 2
>     t = t & chr("&H" & Mid(s, i, 2))
>   next
>   decode = t
> end function
>
> s = "717765727479206376626E....6D6D"
> Set fso = CreateObject("Scripting.FileSystemObject")
> Set f = fso.OpenTextFile("audio.wav", 2, True)
> f.write decode(s)
> f.close()
>
> I suggest you get the downloadable WSH documentation and start using
> it.  Also, the Script Center Example library.
>
> WSH 5.6 documentation download (URL all one line)http://www.microsoft.com/downloads/details.aspx?FamilyId=01592C48-207...
>
> TechNet Script Center Sample Scripts (URL all one line)http://www.microsoft.com/downloads/details.aspx?FamilyID=b4cb2678-daf...
>
> _____________________
> Tom Lavedas
> ------------------
>
> Thank you for the help, Tom.  Looks, Vbscript not supported anymore on Vista
> and Windows 7?
>
> anime
Why do you say that? They are still supported, though there are
restrictions on its use. I don't yet have access to a Vista of Win 7
machine to speak of the specific differences, but have seen many
references - mostly having to do with running at elevated credential
levels.
_____________________
Tom Lavedas
 

My Computer

M

Mayayana

|
| Thank you for the help, Tom. Looks, Vbscript not supported anymore on
Vista
| and Windows 7?
|

You mean the 2nd link? That's just indicating
where the example scripts are known to work.
(You should never take Microsoft's word about
supported systems, anyway. Those particulars
are now coming out of the marketing dept.)

VBS runs in Vista/7 but there could be some
issues if you operate with the standard permission
restrictions. Example: If I remember correctly a
VBS may require permission to run under UAC. You
can right-click and select "Run as Administrator",
but if you drag/drop files onto the script you can't
start it as admin. Another example: HTA files do
not have a "Run as Admin.." context menu.

And then there's also file/Registry virtualization,
which will not allow you to write a file or setting to
a restricted location, but also will not tell you so.
Instead it writes to an allowed path. That can cause
a lot of confusion.

So it works, but you can't assume all scripts that
work on XP will work on Vista/7.
 

My Computer

A

anime

"Tom Lavedas" <[email protected]> wrote in message
news:c21[email protected]
On May 19, 7:08 am, "anime" <[email protected]> wrote:

> "Tom Lavedas" <[email protected]> wrote in message
>
> news:[email protected]
> On May 18, 10:18 am, "anime" <[email protected]> wrote:
>
>
>

> > "Tom Lavedas" <[email protected]> wrote in message
>

> >news:[email protected]
> > On May 17, 7:39 pm, "anime" <[email protected]> wrote:
> > {snip}
>

> > > a bit more detailed code snippet here:
>

> > > Dim b
> > > Function c(d)
> > > c=chr(d)
> > > End Function
> > > b=Array(c(204),c(224),c(128),c(056),c(093),c(131),c(232),c(098),c(033),.....
> > > ..omitted..........c(000),c(000 ),"")
> > > Set fso = CreateObject("Scripting.FileSystemObject")
> > > Set f = fso.OpenTextFile("audio.wav", 2, True)
> > > For i = 0 To 67593
> > > f.write(b(i))
> > > Next
> > > f.close()
> > > .... .......
> > > .....
>

> > > This parts recovers encrypted audio file (67593 bytes size). How to
> > > modify
> > > if use % char as separator (%71%77%65%72%74%79%20%63%76%62%6E%
> > > ...6D%6D)
> > > ?
>

> > Let me see if I understand correctly. You have a string that contains
> > 67,594 hex values in the %DD format that you want to write to a WAV
> > file? Is that right?
>

> > Actually, there is an intrinsic VBS function that translates that kind
> > of a string directly - the unescape() function. In such a case, the
> > solution might be as simple as ...
>

> > s = "%71%77%65%72%74%79%20%63%76%62%6E% ...6D%6D"
> > Set fso = CreateObject("Scripting.FileSystemObject")
> > Set f = fso.OpenTextFile("audio.wav", 2, True)
> > f.write unescape(s)
> > f.close()
>

> > I say *might be* as this is attempting to create a binary file, which
> > can cause the FSO write method some heartburn. Another way is to make
> > use of the ADO binary stream to write the output instead, but I don't
> > have a handy example of that. Plus, if done exactly as I show it, it
> > should work to write binary data.
> > _____________________
> > Tom Lavedas
>

> > -----------
>

> > 67594 bytes is file size. I will be converted into hex format, then this
> > script need recover it, i.e. to write to a binary WAV file.
> > Can it be with specifying target file size?
> > For i = 0 To 67593
>

> > Some converters gives a different hexadecimal string format
> > representing,
> > without separator ("717765727479206300000076626E.......000000"), or "\"
> > separator. What in this case?
> > -------
> > anime
>
> If you keep changing the rules, there's no way to answer. You will
> need to figure it out yourself.
>
> I'll give it one more try and then you're on your own.
>
> s = "717765727479206376626E6D6D" for example
> s = "%71%77%65%72%74%79%20%63%76%62%6E%6D%6D" ' or this
> s = "\71\77\65\72\74\79\20\63\76\62\6E\6D\6D" ' or this
> Set fso = CreateObject("Scripting.FileSystemObject")
> Set f = fso.OpenTextFile("audio.wav", 2, True)
> f.write decode(s)
> f.close()
>
> Function decode(s)
> Dim t1, t2, i
> d = Asc(Ucase(left(s, 1)))
> if d < Asc("0") OR d > Asc("F") then
> t1 = replace(s, Chr(d), "")
> else
> t1 = s
> end if
> for i = 1 to len(t1) step 2
> t2 = t2 & chr("&H" & Mid(t1, i, 2))
> next
> decode = t2
>
> end function
>
> This should work for any length of string with any delimiter (or
> none). The delimiter cannot be any of the digits from 0 to 9 or A to
> F and each character must be defined by a two digit hex number. Other
> than that, it should work with any input string.
> _____________________
> Tom Lavedas
> ----------------
>
> Thank you for input. I want modify decoding a little just for HEX encoding
> with no delimiter.
>
> Function decode(s)
> Dim t1, t2, i
> d = Asc(Ucase(left(s, 1)))
> if d < Asc("0") OR d > Asc("F") then
> t1 = replace(s, Chr(d), "")
> else
> t1 = s
> end if
> for i = 1 to len(t1) step 2
> t2 = t2 & chr("&H" & Mid(t1, i, 2))
> next
> decode = t2
> end function
>
> s = "717765727479206376626E....6D6D"
> Set fso = CreateObject("Scripting.FileSystemObject")
> Set f = fso.OpenTextFile("audio.wav", 2, True)
> For i = 0 To 67593
> f.write decode(s)
> f.close()
> Set WshShell = WScript.CreateObject("WScript.Shell")
> ... ....
> ... .....
>
> Thanks.
Function decode(s)
Dim t, i
for i = 1 to len(s) step 2
t = t & chr("&H" & Mid(s, i, 2))
next
decode = t
end function

s = "717765727479206376626E....6D6D"
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile("audio.wav", 2, True)
f.write decode(s)
f.close()

I suggest you get the downloadable WSH documentation and start using
it. Also, the Script Center Example library.

WSH 5.6 documentation download (URL all one line)
http://www.microsoft.com/downloads/details.aspx?FamilyId=01592C48-207D-4BE1-8A76-1C4099D7BBB9&displaylang=en

TechNet Script Center Sample Scripts (URL all one line)
http://www.microsoft.com/downloads/details.aspx?FamilyID=b4cb2678-dafb-4e30-b2da-b8814fe2da5a

_____________________
Tom Lavedas

---------------

Just I forgot to ask: is there any difference where place decoding function:
before s = "717765727479206376626E....6D6D" (as in last code) or after, as
in your earlier example?

anume
 

My Computer

T

Tom Lavedas

On May 19, 10:44 am, "anime" <[email protected]> wrote:

> Just I forgot to ask: is there any difference where place decoding function:
> before s = "717765727479206376626E....6D6D" (as in last code) or after,as
> in your earlier example?
>
> anume
No, though it is customarily placed after the main body of the script.
The one exception is in a WSH (XML) structured script file. Then the
definitions must precede there use.
_____________________
Tom Lavedas
 

My Computer

Top