From: Tom Lavedas on
On May 19, 9:06 am, "anime" <an...(a)nospam.microsoft.news> wrote:
> "Tom Lavedas" <tglba...(a)verizon.net> wrote in message
>
> news:c216e015-bbce-4271-a548-08524b569748(a)f14g2000vbn.googlegroups.com...
> On May 19, 7:08 am, "anime" <an...(a)nospam.microsoft.news> wrote:
>
>
>
> > "Tom Lavedas" <tglba...(a)verizon.net> wrote in message
>
> >news:8732a41f-1e98-48d5-ba7c-e30bdd442759(a)d12g2000vbr.googlegroups.com....
> > On May 18, 10:18 am, "anime" <an...(a)nospam.microsoft.news> wrote:
>
> > > "Tom Lavedas" <tglba...(a)verizon.net> wrote in message
>
> > >news:bbbe77b3-cc21-46ad-a06b-e7755c230a58(a)c13g2000vbr.googlegroups.com....
> > > On May 17, 7:39 pm, "anime" <an...(a)nospam.microsoft.com> 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
From: Mayayana on
|
| 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.


From: anime on

"Tom Lavedas" <tglbatch(a)verizon.net> wrote in message
news:c216e015-bbce-4271-a548-08524b569748(a)f14g2000vbn.googlegroups.com...
On May 19, 7:08 am, "anime" <an...(a)nospam.microsoft.news> wrote:
> "Tom Lavedas" <tglba...(a)verizon.net> wrote in message
>
> news:8732a41f-1e98-48d5-ba7c-e30bdd442759(a)d12g2000vbr.googlegroups.com...
> On May 18, 10:18 am, "anime" <an...(a)nospam.microsoft.news> wrote:
>
>
>
> > "Tom Lavedas" <tglba...(a)verizon.net> wrote in message
>
> >news:bbbe77b3-cc21-46ad-a06b-e7755c230a58(a)c13g2000vbr.googlegroups.com...
> > On May 17, 7:39 pm, "anime" <an...(a)nospam.microsoft.com> 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

From: Tom Lavedas on
On May 19, 10:44 am, "anime" <an...(a)nospam.microsoft.news> 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